Adding a Tool
v1 status: stub. Step-by-step walkthrough TBD. In the meantime, see
examples/custom_tool.rsin the rantaiclaw repo and read Concepts → Tools & Skills.
The shape
- Create
src/tools/<your_tool>.rsand implement theTooltrait - Define a strict JSON Schema for parameters — what the LLM is told is what the runtime validates
- Return
ToolResult, never panic - Register in
src/tools/mod.rs - Add tests for success, validation failure, and security-denied paths
Anti-patterns to avoid
- Tools that wrap arbitrary shell commands. Use the existing
shelltool with an allowlist; do not write a new “shell-with-extra-flags” tool. - Tools that bypass the approval gate. The gate runs before
execute; you do not opt out. - Tools that mutate gateway / security policy directly. That is an architecture boundary violation; the policy lives in
src/security/for a reason.
Reference implementations
src/tools/file_read.rs— minimal read-only toolsrc/tools/shell.rs— shell with sandbox + allowlistsrc/tools/web_search.rs— outbound HTTP with structured resultsrc/tools/memory_recall.rs— semantic search over memory
Last updated on