- A client discovers tools via
tools/list(each tool includesinputSchemaand optionaloutputSchema). - A client calls a tool via
tools/callwithargumentsmatching the schema. - The server executes your callable.
- The server returns a
CallToolResultcontainingcontent(and optionallystructuredContent) per MCP Spec.
Basic tool
Async tools
async def and offload explicitly.
Type inference
Type hints become JSON Schema automatically:list, dict, Literal, Enum, optionals/unions, Pydantic models, dataclasses, nested models.
Required parameters have no default. Optional parameters have one.
Decorator options
Structured returns
Return JSON-serializable values:CallToolResult:
Context access
Logging and progress viaget_context():
Allow-lists
Restrict visible tools:CallToolResult indicating the tool is not available.