src/tools/README.md
src/tools/builtin/my_tool.rsTool traitmod my_tool; and pub use in src/tools/builtin/mod.rsToolRegistry::register_builtin_tools() in registry.rsWASM tools are the preferred way to add new capabilities. They run in a sandboxed environment with explicit capabilities.
tools-src/<name>/wit/tool.wit)<name>.capabilities.json declaring required permissionscargo build --target wasm32-wasip2 --releaseironclaw tool install path/to/tool.wasmSee tools-src/ for examples.
CRITICAL: Keep tool-specific logic out of the main agent codebase.
The main agent provides generic infrastructure; tools are self-contained units that declare their requirements through capabilities files.
auth notion, auth slack)Tools declare their auth requirements in <tool>.capabilities.json under the auth section. Two methods are supported:
For services that support OAuth, users just click through browser login:
{
"auth": {
"secret_name": "notion_api_token",
"display_name": "Notion",
"oauth": {
"authorization_url": "https://api.notion.com/v1/oauth/authorize",
"token_url": "https://api.notion.com/v1/oauth/token",
"client_id_env": "NOTION_OAUTH_CLIENT_ID",
"client_secret_env": "NOTION_OAUTH_CLIENT_SECRET",
"scopes": [],
"use_pkce": false,
"extra_params": { "owner": "user" }
},
"env_var": "NOTION_TOKEN"
}
}
To enable OAuth for a tool:
http://localhost:9876/callback through http://localhost:9886/callbackFor services without OAuth or when OAuth isn't configured:
{
"auth": {
"secret_name": "openai_api_key",
"display_name": "OpenAI",
"instructions": "Get your API key from platform.openai.com/api-keys",
"setup_url": "https://platform.openai.com/api-keys",
"token_hint": "Starts with 'sk-'",
"env_var": "OPENAI_API_KEY"
}
}
When running ironclaw tool auth <tool>:
env_var - if set in environment, use it directlyoauth - if configured, open browser for OAuth flowinstructions + manual token entryThe agent reads auth config from the tool's capabilities file and provides the appropriate flow. No service-specific code in the main agent.
Both are first-class in the extension system (ironclaw tool install handles both), but they have different strengths.
WASM Tools (IronClaw native)
capabilities.json, agent handles the flowMCP Servers (Model Context Protocol)
Decision guide:
| Scenario | Use |
|---|---|
| Good MCP server already exists | MCP |
| Handles sensitive credentials (email send, banking) | WASM |
| Quick prototype or one-off integration | MCP |
| Core capability you'll maintain long-term | WASM |
| Needs background connections (websockets, polling) | MCP |
| Multiple tools share one OAuth token (e.g., Google suite) | WASM |
The LLM-facing interface is identical for both (tool name, schema, execute), so swapping between them is transparent to the agent.