Skip to main content

Setup

Set 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 from STOPHY_API_KEY.
stophy.ts

Use it as a tool

Define the search as a tool with betaZodTool. The tool runner calls it whenever Claude asks, and returns Claude’s final message.