Skip to main content
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:
  1. A client discovers tools via tools/list (each tool includes inputSchema and optional outputSchema).
  2. A client calls a tool via tools/call with arguments matching the schema.
  3. The server executes your callable.
  4. The server returns a CallToolResult containing content (and optionally structuredContent) per MCP Spec.

Basic tool

The description tells the LLM what the tool does. Type hints become JSON Schema.

Async tools

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