Problem
MCPServer has add_tool() and remove_tool() as public methods, but no public get_tool(name) to retrieve a registered tool by name.
ToolManager already exposes a public get_tool(name: str) -> Tool | None:
https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/server/mcpserver/tools/tool_manager.py#L31
But MCPServer._tool_manager is private, so downstream consumers must access mcp._tool_manager.get_tool(name) — which relies on an internal attribute.
Use Case
Downstream projects need to modify a tool's inputSchema after registration. For example, attaching oneOf discriminated action schemas after initial tool registration.
Currently, the only way to get a tool's schema is via list_tools() (returns all tools, must filter by name). There is no way to update a schema without accessing private internals.
Proposed Solution
Add a public method:
class MCPServer:
def get_tool(self, name: str) -> Tool | None:
"""Get a registered tool by name."""
return self._tool_manager.get_tool(name)
Optionally, also consider exposing list_tools() directly on MCPServer (currently delegated through _handle_list_tools), and/or an update_tool_input_schema() method for the schema-update use case.
Why This Matters
- Completeness: add_tool / remove_tool / get_tool form a natural CRUD trio
- Encapsulation: consumers should not depend on _tool_manager internals
- Forward compatibility: if _tool_manager is refactored, downstream breaks
Version
mcp==2.0.0b1 — checked that ToolManager.get_tool is already public.
Problem
MCPServer has add_tool() and remove_tool() as public methods, but no public get_tool(name) to retrieve a registered tool by name.
ToolManager already exposes a public get_tool(name: str) -> Tool | None:
https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/server/mcpserver/tools/tool_manager.py#L31
But MCPServer._tool_manager is private, so downstream consumers must access mcp._tool_manager.get_tool(name) — which relies on an internal attribute.
Use Case
Downstream projects need to modify a tool's inputSchema after registration. For example, attaching oneOf discriminated action schemas after initial tool registration.
Currently, the only way to get a tool's schema is via list_tools() (returns all tools, must filter by name). There is no way to update a schema without accessing private internals.
Proposed Solution
Add a public method:
Optionally, also consider exposing list_tools() directly on MCPServer (currently delegated through _handle_list_tools), and/or an update_tool_input_schema() method for the schema-update use case.
Why This Matters
Version
mcp==2.0.0b1 — checked that ToolManager.get_tool is already public.