Document and normalize MCP tool filter names - #2101
Conversation
|
Thanks for digging into this, and for the detailed writeup in #869. The repro is clear and this is a genuinely confusing failure mode (zero tools, no error, hooks never fire). Before going further with the code change, I want to flag something that changes the right scope here: the def add_mcp(self, tool_name: str) -> ToolSet:
"""Add an MCP tool pattern (e.g. "github-list_issues" or "*")."""The same docstring/example exists in the nodejs, dotnet, java, go, and rust SDKs too ( Given that, I think the right-sized fix here is docs-only, and should probably span all the SDKs rather than just Python, since the naming convention is a backend/CLI-level thing and every language hits the same trap:
I'd rather not add the auto-alias-expansion logic in
Would you be up for narrowing this PR to the doc changes (README + docstrings) and applying the same wording across the other SDK directories? This is a good contribution, just want to make sure it lands in the most maintainable spot. |
Title:
Fix MCP tool-name prefix handling in Python SDKDescription:
Fixes #869
This PR documents that MCP tools registered via
mcp_serversare exposed to the runtime as<server-key>-<tool-name>, and updates Python tool-filter handling so bare MCP tool names automatically gain matching server-prefixed aliases when the corresponding MCP server exposes them, including wildcard server configs (tools=["*"]).Changes included:
python/copilot/_mode.pyand wired it into the Python session create/resume pathsavailable_tools,excluded_tools, custom-agenttools, anddefault_agent.excluded_tools<server-key>-<tool-name>convention and SDK normalization behavior inpython/copilot/session.pyandpython/README.mdpython/test_tool_set.pyandpython/test_client.py