Handle tool calls.
(
name: str, arguments: dict | None
)
| 34 | |
| 35 | @server.call_tool() |
| 36 | async 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 | |
| 47 | async def main(): |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…