Overview
PicoClaw’s tool system is extensible - you can create custom tools to give your agent new capabilities. Tools are Go functions that follow a specific interface and get registered with the ToolRegistry.Tool Interface
Every tool must implement theTool interface:
Creating a Custom Tool
Step 1: Define Your Tool Struct
Step 2: Implement the Interface
Step 3: Register the Tool
In your agent initialization code:Tool Result Types
Tools return*ToolResult with different types:
Example: API Client Tool
Here’s a more complex example - a tool that calls an external API:Tool Safety
Workspace Restriction
If your tool accesses files, respect workspace restrictions:Input Validation
Always validate input parameters:Timeout Protection
For long-running operations, use contexts:Configuration
Add tool-specific configuration:Best Practices
Clear descriptions
Write detailed tool descriptions so the LLM knows when to use your tool
Validate inputs
Always validate and sanitize input parameters
Handle errors gracefully
Return meaningful error messages that help the agent understand what went wrong
Use timeouts
Protect against hanging operations with context timeouts
Respect security
Follow workspace restrictions and safety patterns
Keep it focused
One tool, one clear purpose - don’t create Swiss Army knives
Testing Your Tool
Create unit tests for your custom tool:Next Steps
Tool Registry
Learn about the tool registry and how tools are discovered
Built-in Tools
Study the built-in tools for examples
Agent Configuration
Configure tool access and restrictions
MCP Tools
Alternative: Use Model Context Protocol for external tools