1. Define the tool contract

A tool needs a name, description, JSON Schema input, and an execute function.

2. Register the tool

Add the tool to a ToolRegistry. Use a namespace to prevent naming collisions.
The qualified name becomes demo.weather.

3. Validate arguments

Before executing, validate inputs against the schema:

4. Use the tool

Tools are normally executed by the harness, but you can call one directly for testing:

5. Register a deferred tool

Deferred tools are known to the registry but not injected into active schemas until the model calls tool_activate:
The model discovers deferred tools through tool_search and activates them through tool_activate.

6. Expose over MCP

Make the same tool available to external MCP clients:

7. Snapshot and rehydrate

Persist tool registry state across turns or sessions:

Hosting tools on the platform

For tools that need organization-wide sharing, sandbox isolation, or access to shared secrets, register them as server tools instead of local custom tools. Server tools run inside the Cloud Sandbox and shadow native tools with the same name. See Server Tools for the admin API and execution flow.