Context
Building any capability that agents can use.
Problem
Agents need well-defined units of functionality they can discover, understand, and invoke.
Solution
A Tool is the fundamental building block: a named, typed function with:
- Name: Reflects intent (verb_noun pattern)
- Description: LLM-optimized explanation
- Parameters: Typed inputs with constraints
- Return type: Structured output
- Side effects: Documented state changes
- Name: Reflects intent (verb_noun pattern)
- Description: LLM-optimized explanation
- Parameters: Typed inputs with constraints
- Return type: Structured output
- Side effects: Documented state changes
Examples
Python
@tool
def send_email(
recipient: str,
subject: str,
body: str
) -> SendResult:
"""Send an email to a recipient."""
# Tool implementation TypeScript
const sendEmail = tool({
name: "send_email",
description: "Send an email to a recipient",
parameters: z.object({
recipient: z.string(),
subject: z.string(),
body: z.string()
}),
execute: async (params) => { /* ... */ }
}); Considerations
- One tool = one clear responsibility
- Names should be verbs reflecting the action
- Document all side effects explicitly