MCPcopy Create free account
hub / github.com/modelcontextprotocol/mcpb / handle_call_tool

Function handle_call_tool

examples/hello-world-uv/src/server.py:36–44  ·  view source on GitHub ↗

Handle tool calls.

(
    name: str, arguments: dict | None
)

Source from the content-addressed store, hash-verified

34
35@server.call_tool()
36async def handle_call_tool(
37 name: str, arguments: dict | None
38) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
39 """Handle tool calls."""
40 if name == "say_hello":
41 person_name = arguments.get("name", "World") if arguments else "World"
42 return [types.TextContent(type="text", text=f"Hello, {person_name}!")]
43
44 raise ValueError(f"Unknown tool: {name}")
45
46
47async def main():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…