Setup
ANTHROPIC_API_KEY in your environment. STOPHY_API_KEY is optional for this example.
The Stophy tool
This function calls web search and returns the results as markdown, which is short and easy for a model to read. It reads your key fromSTOPHY_API_KEY.
stophy.ts
Use it as a tool
Define the search as a tool withbetaZodTool. The tool runner calls it whenever Claude asks, and returns Claude’s final message.