Skip to content

Python: Make MCP server tool names consistent - #14506

Merged
SergeyMenshykh merged 3 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-mcp-tool-name-consistency
Oct 1, 2026
Merged

SergeyMenshykh merged 3 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-mcp-tool-name-consistency

Conversation

@SergeyMenshykh

Copy link
Copy Markdown
Contributor

Summary

  • Keep the first function when MCP tool names collide, warn for skipped duplicates, and dispatch calls to the exact advertised function.
  • Add opt-in plugin-qualified tool names and warn when names exceed MCP's recommended length.
  • Update MCP server documentation and cover naming, duplicate registration, exclusions, dispatch, and agent forwarding with tests.

Validation

  • 70 focused MCP connector and agent tests passed.
  • Ruff formatting passed; four changed Python files lint clean. The six Ruff property-docstring findings in agent.py also occur at the upstream base.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 13:31
@SergeyMenshykh
SergeyMenshykh requested a review from a team as a code owner September 30, 2026 13:31
@semantic-kernel-automation semantic-kernel-automation Bot added python Pull requests for the Python Semantic Kernel documentation labels Sep 30, 2026
@SergeyMenshykh SergeyMenshykh self-assigned this Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation consistently preserves advertised tool identity and includes focused coverage for the affected behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Makes Python MCP tool naming deterministic and consistent across kernels, functions, and agents.

Changes:

  • Adds optional plugin-qualified tool names and length warnings.
  • Retains the first duplicate and dispatches to the advertised function.
  • Expands tests and MCP sample documentation.
File Description
python/​semantic_kernel/​connectors/​mcp.py Implements naming, collision handling, warnings, and exact dispatch.
python/​semantic_kernel/​kernel.py Exposes the naming option through kernels.
python/​semantic_kernel/​agents/​agent.py Forwards the naming option from agents.
python/​tests/​unit/​connectors/​mcp/​test_mcp.py Tests collisions, exclusions, naming, limits, and dispatch.
python/​tests/​unit/​agents/​test_agent.py Tests agent tool naming.
python/​samples/​demos/​mcp_server/​README.md Documents default and qualified names.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@semantic-kernel-automation semantic-kernel-automation Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 1b3d445d8387
Model: gpt-5.6-sol

Overview

The change consistently binds advertised MCP schemas to the exact function invoked, rejects unexposed names, preserves bare-name exclusions, and adds focused coverage for duplicate ordering, qualified names, length warnings, and wrapper forwarding. Two less-common but valid plugin configurations remain broken: aliased kernel plugin dictionaries now fail during server construction, and create_mcp_server_from_functions does not honor its plugin_name contract for existing KernelPlugin inputs when qualified naming is enabled.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
2 verified findings remained after source verification (2 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: python/semantic_kernel/connectors/mcp.py

Comment thread python/semantic_kernel/connectors/mcp.py Outdated
Comment thread python/semantic_kernel/connectors/mcp.py Outdated
SergeyMenshykh and others added 2 commits September 30, 2026 15:19
Retain concrete functions during tool enumeration and use the shared fully qualified name separator. Cover alias naming, duplicate ordering, exclusions, retained dispatch, and name-length boundaries.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve Kernel.add_plugin behavior for existing KernelPlugin instances. Document the plugin_name exception and cover retained names, dispatch, and distinct plugin namespaces with regression tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Oct 1, 2026
Merged via the queue into microsoft:main with commit ee23e07 Oct 1, 2026
32 of 80 checks passed
@SergeyMenshykh
SergeyMenshykh deleted the sergeymenshykh-mcp-tool-name-consistency branch October 1, 2026 12:32

This branch was previously deployed

1 inactive deployment
github-app-auth — 7f24493a Deployed Sep 30, 2026 by SergeyMenshykh via add_label #29179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation python Pull requests for the Python Semantic Kernel

Projects

Status: Done
Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants