Repository navigation
Python: Make MCP server tool names consistent - #14506
SergeyMenshykh merged 3 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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>
Summary
Validation