WIT Tool Authoring
Every RunVero tool is a WASI 0.2 component that implements the contract in wit/agent-tool.wit.
The WIT contract
Section titled “The WIT contract”package runvero:tooling@0.1.0;
world tool-executor { export execute: func(input: string) -> result<string, string>;}
world http-tool-executor { import wasi:cli/environment@0.2.12; import wasi:http/outgoing-handler@0.2.12; import wasi:http/types@0.2.12; export execute: func(input: string) -> result<string, string>;}- A tool exports one function,
execute. It takes a string and returns either an output string or an error string. inputis the tool’s arguments as a JSON object. The host checks them against theinput_schemain the tool’s manifest before the tool runs.- Return
Okwith your output (usually JSON) orErrwith a message the caller can act on. - Tools that call HTTP APIs target
http-tool-executor. Their requests only reach hosts that both the manifest and the operator allow. Secrets arrive asrvsec_...placeholders in the environment, and the host swaps in the real value only on requests to the bound host.
The host sets the limits, not the tool: every call runs with a fuel (instruction) budget, a memory cap and a timeout.
Build a tool in Rust
Section titled “Build a tool in Rust”Rust is the supported authoring language. You need the runvero CLI (build it from source) and Rust with the wasm32-wasip2 target:
rustup target add wasm32-wasip21. Scaffold the project
Section titled “1. Scaffold the project”runvero init my-tool --lang rustcd my-toolThis creates a Cargo project with the WIT files, a runvero.tool.json manifest, sample input and test fixtures.
2. Implement execute
Section titled “2. Implement execute”src/lib.rs generates bindings from the bundled WIT and implements the Guest trait:
use serde::{Deserialize, Serialize};
wit_bindgen::generate!({ path: "wit", world: "tool-executor",});
#[derive(Deserialize)]struct InputArgs { message: String, #[serde(default)] uppercase: bool,}
#[derive(Serialize)]struct OutputPayload { processed: String, word_count: usize,}
struct Component;
impl Guest for Component { fn execute(input: String) -> Result<String, String> { let args: InputArgs = serde_json::from_str(&input).map_err(|err| format!("invalid JSON input: {err}"))?;
if args.message.trim().is_empty() { return Err("message must not be blank".to_string()); }
let processed = if args.uppercase { args.message.to_uppercase() } else { args.message.clone() };
serde_json::to_string(&OutputPayload { word_count: args.message.split_whitespace().count(), processed, }) .map_err(|err| format!("failed to serialize output: {err}")) }}
export!(Component);3. Describe the tool in its manifest
Section titled “3. Describe the tool in its manifest”runvero.tool.json tells the host and MCP clients what the tool does, what input it accepts and what it may use:
{ "schema_version": "runvero.tool/v1", "name": "my_tool", "version": "0.1.0", "description": "Sandboxed WASI 0.2 RunVero tool (my_tool).", "component": "my_tool.wasm", "input_schema": { "type": "object", "properties": { "message": { "type": "string", "minLength": 1, "maxLength": 4096 }, "uppercase": { "type": "boolean", "default": false } }, "required": ["message"], "additionalProperties": false }, "resources": { "fuel": 5000000, "memory_mb": 16, "timeout_ms": 2000 }, "capabilities": { "allowed_hosts": [], "secret_bindings": [] }}resources is the budget the tool asks for, and runvero test never runs above it. Empty allowed_hosts means no network access. The full format is in the tool manifest spec.
4. Build, test and run
Section titled “4. Build, test and run”runvero buildrunvero testrunvero run . --args '{"message": "hello runvero", "uppercase": true}'runvero build compiles to wasm32-wasip2 and checks that the component exports execute on runvero:tooling/[email protected] and imports only supported WASI 0.2 interfaces. runvero test runs the manifest examples and tests/fixtures.json inside the sandbox:
[PASS] default-greeting (1.06 MiB, 6,550 fuel, 0.14 ms) [PASS] uppercase-transform (1.06 MiB, 7,567 fuel, 0.10 ms) [PASS] reject-blank-message (0 B, 0 fuel, 0.00 ms) [PASS] reject-missing-required-field (0 B, 0 fuel, 0.00 ms)
Test result: PASSED (4 passed, 0 failed)Python and TypeScript
Section titled “Python and TypeScript”Preview. Python (runvero-guest) and TypeScript (@runvero/guest) authoring work inside a checkout of the runvero repository, but the packages are not published yet. See the WIT development guide for the in-repository steps.