Documentation Index
Fetch the complete documentation index at: https://docs.emergence.ai/llms.txt
Use this file to discover all available pages before exploring further.
Tool Authoring
Tools are the primary way agents access external capabilities — databases, APIs, file storage, computation environments. Getting tools right is critical: poorly specified tools are the leading cause of agent errors, context bloat, and cost overruns.Function Tools
Function tools are Python functions that the LLM can call directly. Every supported framework converts them to the appropriate wire format for the underlying model.Writing a Good Tool
A well-authored function tool has four properties:- A descriptive docstring — the LLM reads this to decide when to call the tool
- Typed parameters — every parameter has an explicit type annotation and docstring description
- A bounded return type — string, dict, or a typed Pydantic model; never untyped or variable-shape
- Minimal side effects — each call does one thing; avoid tools that “do everything”
Schema Discipline
The tool’s parameter schema is sent to the LLM on every call. Verbose or inaccurate schemas degrade routing quality and inflate cost.Use narrow types
Use narrow types
Prefer
Literal["postgres", "redshift", "bigquery"] over str when the set of valid values is known. The LLM will hallucinate less when the schema constrains choices.Mark optional parameters explicitly
Mark optional parameters explicitly
Use
Optional[T] with a sensible default. Never use Union[T, None] without a default — the LLM will try to supply a value when it shouldn’t.Return structured errors, not exceptions
Return structured errors, not exceptions
Raise only for truly unrecoverable situations. For expected failures (table not found, invalid SQL), return a structured error dict so the LLM can understand and recover.
MCP Tools via FastMCPToolset
CRAFT exposes platform capabilities throughem-runtime-mcp — an MCP server. Pydantic AI connects to it via FastMCPToolset; Google ADK can connect via a MCPToolset wrapper.
Pydantic AI — FastMCPToolset
A production-grade pattern for connecting a Pydantic AI agent to the CRAFT MCP server:Google ADK — MCP Tool Integration
Google ADK connects to the CRAFT MCP server usingStreamableHTTPConnectionParams:
The older import
from google.adk.toolsets.mcp import MCPToolset is deprecated. Use from google.adk.tools.mcp_tool import MCPToolset, StreamableHTTPConnectionParams (ADK v1.0+).Claude Agent SDK — MCP Tool Integration
The Anthropic API’smcp_servers connector only supports authorization_token — it cannot pass X-Project-ID as a separate header. Use the mcp Python SDK with a session-aware client to call CRAFT tools from a standard function-tool loop:
LangGraph — MCP Tool Integration
LangGraph connects to CRAFT viaMultiServerMCPClient from langchain-mcp-adapters (install: pip install langchain-mcp-adapters):
langchain-mcp-adapters supports headers for static auth values. If the access token expires mid-session, reinitialise the client — dynamic per-request token injection is a known limitation.Cross-Framework Tool Comparison
| Feature | Google ADK | Claude Agent SDK | Pydantic AI | LangGraph |
|---|---|---|---|---|
| Function tools | tools=[my_fn] | tools=[{name, description, input_schema}] | @agent.tool decorator or tools=[my_fn] | bind_tools([my_fn]) |
| CRAFT MCP connection | MCPToolset + StreamableHTTPConnectionParams | mcp SDK streamablehttp_client + function tools | FastMCPToolset + StreamableHttpTransport (first-class) | MultiServerMCPClient (transport="http") |
| Parallel tool calls | Yes (automatic) | Yes (with betas=["interleaved-thinking"]) | parallel_tool_calls=True in ModelSettings | Node-level parallelism |
| Tool retry on failure | ADK handles automatically | Manual in tool loop | ModelRetry exception | Conditional edges |
| Context injection | ToolContext | Manual in tool dispatch | RunContext[Deps] | RunnableConfig |
Limiting Iteration and Cost
Unbounded tool call loops are the leading cause of cost overruns. Implement iteration limits defensively.Pre-Flight Validation
Validate tool inputs before making expensive network calls. AFastMCPToolset subclass can run a lint pass before code execution:
Next Steps
Multi-Agent Patterns
Use tools and sub-agents together in orchestrated workflows.
Debugging Agents
Inspect tool call traces and diagnose tool failures.

