Tools let agents call your Python functions. Decorate, register, serve.
Tools are the core building blocks that allow an MCP client to invoke your Python functions via the MCP protocol:
- A client discovers tools via
tools/list (each tool includes inputSchema and optional outputSchema).
- A client calls a tool via
tools/call with arguments matching the schema.
- The server executes your callable.
- The server returns a
CallToolResult containing content (and optionally structuredContent) per MCP Spec.
The description tells the LLM what the tool does. Type hints become JSON Schema.
Prefer async for I/O.
Important: in Dedalus MCP, sync tools run inline (they are not automatically moved to a thread pool). If you need concurrency for blocking work, use async def and offload explicitly.
Type inference
Type hints become JSON Schema automatically:
Supported: primitives, 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:
For explicit control, return CallToolResult:
Context access
Logging and progress via get_context():
Allow-lists
Restrict visible tools:
Calling a hidden tool returns an error CallToolResult indicating the tool is not available.
Error handling
Raise exceptions normally:
Testing
Test tools as normal functions:
For tools using context, test the core logic separately (or use an integration-style harness). Last modified on June 30, 2026