Skip to main content
IronClaw’s WASM tool system lets you extend the agent’s capabilities by building sandboxed tools that run securely with explicit permissions.

Overview

WASM tools are WebAssembly components that:
  • Run in a sandboxed environment with capability-based permissions
  • Execute faster than external processes
  • Declare capabilities in a capabilities.json file
  • Never see actual credentials (host injects them at runtime)

Quick Start

Prerequisites

  • Rust 1.85+ with wasm32-wasip2 target
  • wasm-tools CLI (optional, for component adaptation)

Project Structure

Step 1: Create Cargo.toml

Step 2: Implement the Tool

Import WIT Bindings

Implement the Guest Trait

Step 3: Create Capabilities File

Create my-tool.capabilities.json:

Step 4: Build the Tool

Step 5: Install the Tool

Or copy manually:

Host Functions Available

Logging

HTTP Requests

Workspace Access

Time

Credential Injection

Never hardcode secrets! Use placeholders:
Placeholder format: {SECRET_NAME} where SECRET_NAME is the credential name in uppercase with underscores.

Testing

Add tests to lib.rs:
Run tests:

LLM-Assisted Building

IronClaw can build tools for you:
The agent will:
  1. Generate the Rust source code
  2. Create the capabilities file
  3. Build to WASM
  4. Install the tool
  5. Make it available for use
See src/tools/builder/ for implementation details.

Troubleshooting

Compilation Errors

Error: can’t find crate for std Ensure you’re using wasm32-wasip2 target:

Credential Placeholders Not Replaced

  1. Check the secret name matches (lowercase with underscores in capabilities)
  2. Verify the secret is in allowed_names in capabilities
  3. Ensure the secret is stored: ironclaw tool auth my_tool
  4. Check logs for “unresolved placeholders” warnings

HTTP Requests Blocked

  1. Add the host to http.allowlist in capabilities
  2. Check path_prefix matches the request path
  3. Verify the host is exactly as it appears in the URL

Best Practices

  1. Keep tools focused: One tool, one purpose
  2. Validate inputs: Check all parameters before processing
  3. Handle errors gracefully: Return clear error messages
  4. Use rate limits: Protect against abuse
  5. Test thoroughly: Include unit tests and integration tests
  6. Document parameters: Clear descriptions in the schema
  7. Never expose secrets: Use placeholders, not hardcoded values

Examples

Check the bundled tools in tools-src/:
  • github/ - GitHub API integration
  • slack/ - Slack messaging
  • gmail/ - Gmail operations
  • google-calendar/ - Calendar management
  • web-search/ - Web search

Next Steps