spoon-tool-development
Tool Development
Build tools for SpoonOS agents using BaseTool and FastMCP.
Tool Types
| Type | Use Case |
|---|---|
BaseTool |
Local Python tools |
MCPTool |
External MCP servers |
FastMCP |
Build MCP servers |
Quick Start
from spoon_ai.tools.base import BaseTool
from pydantic import Field
class MyTool(BaseTool):
name: str = "my_tool"
description: str = "Tool description"
parameters: dict = Field(default={
"type": "object",
"properties": {
"param": {"type": "string"}
},
"required": ["param"]
})
async def execute(self, param: str) -> str:
return f"Result: {param}"
Scripts
| Script | Purpose |
|---|---|
| base_tool.py | BaseTool implementation |
| mcp_tool.py | MCPTool configuration |
| fastmcp_server.py | FastMCP server |
| tool_manager.py | ToolManager usage |
References
| Reference | Content |
|---|---|
| error_handling.md | Error patterns |
| testing.md | Testing tools |
ToolManager Methods
| Method | Description |
|---|---|
add_tool(tool) |
Add single tool |
remove_tool(name) |
Remove by name |
execute(name, input) |
Execute tool |
to_params() |
Get OpenAI specs |
Best Practices
- Use async for all I/O operations
- Return ToolResult/ToolFailure
- Validate inputs before execution
- Implement proper error handling
- Use environment variables for secrets
More from xspoonai/spoon-awesome-skill
cross-chain-bridge
Cross-chain bridge skill for LayerZero, Wormhole, Stargate, and multi-chain asset transfers
6solana-ecosystem
Solana ecosystem skill for development, DeFi, NFTs, and on-chain analysis
3web3-dao-tooling
Build DAO governance agents with SpoonOS. Use when monitoring proposals, automating voting, managing delegations, or analyzing governance patterns.
3neo-ecosystem
Neo N3 blockchain interaction skill for wallet management, smart contracts, and NeoFS storage
3spoon-erc8004-standard
Implement ERC-8004 trustless agent identity. Use when registering agents on-chain, managing reputation, handling validation, or generating DID documents.
3spoon-graph-development
Build StateGraph workflows with SpoonOS. Use when creating multi-step workflows, conditional routing, parallel execution, checkpointing, or multi-agent orchestration.
3