Tools
Tools give agents the ability to interact with the world — reading files, writing code, running shell commands, searching codebases, and more. Chimera ships 20 built-in tools and provides two ways to define custom tools: a class-based approach via BaseTool and a decorator-based shortcut via @tool.
The BaseTool ABC
Section titled “The BaseTool ABC”Every tool in Chimera extends BaseTool, defined in chimera.core.tool:
class BaseTool(ABC): name: str # Tool name (used in LLM function calling) description: str # Description shown to the model parameters: dict[str, Any] # JSON Schema for arguments requires_approval: bool = False # Whether the tool needs human approval
@abstractmethod def execute(self, args: dict[str, Any], env: Environment | None) -> ToolResult: """Execute the tool with given arguments."""
def to_openai_schema(self) -> dict[str, Any]: """Convert to OpenAI function calling format."""
def to_anthropic_schema(self) -> dict[str, Any]: """Convert to Anthropic tool use format."""Key points:
execute()receives the parsed arguments and an optionalEnvironment, and returns aToolResult(output, error, metadata).to_openai_schema()andto_anthropic_schema()generate the schema format each provider expects. You only need to defineparametersonce as JSON Schema.requires_approvalcan flag dangerous tools for human-in-the-loop confirmation (when used with aPermissionPolicyinLoopConfig).
The @tool Decorator
Section titled “The @tool Decorator”For simple tools, skip the class and use the @tool decorator:
from chimera.core.tool import tool
@tool( name="word_count", description="Count words in a file", parameters={ "type": "object", "properties": { "path": {"type": "string", "description": "Path to the file"}, }, "required": ["path"], },)def word_count(args, env): content = env.read_file(args["path"]) count = len(content.split()) return ToolResult(output=f"{count} words")The decorator wraps your function in a _FunctionTool instance that implements BaseTool. The function signature is always (args: dict, env: Environment | None) -> ToolResult.
ToolGroup
Section titled “ToolGroup”ToolGroup organizes tools into named collections, like a preset toolkit:
from chimera.core.tool_group import ToolGroupfrom chimera.tools import ReadFileTool, WriteFileTool, BashTool, SearchTool
coding_tools = ToolGroup("coding", [ ReadFileTool(), WriteFileTool(), BashTool(), SearchTool(),])
# Iterate, look up by name, add tools dynamicallycoding_tools.has("bash") # Truecoding_tools.get("bash") # BashTool instancecoding_tools.add(my_tool) # Add a custom toollen(coding_tools) # Number of toolslist(coding_tools) # Iterate over toolsDEFAULT_TOOLS
Section titled “DEFAULT_TOOLS”Chimera provides a pre-built DEFAULT_TOOLS group with the essential tools:
from chimera.core.tool_group import DEFAULT_TOOLS
# Contains: ReadFileTool, WriteFileTool, BashTool, ImageReadToolagent = Agent(provider=provider, tools=list(DEFAULT_TOOLS))