Skip to main content
Your app gives the model a web_search tool. When the model asks to search, your code calls Stophy and returns the results. Install stophy with npm install stophy and set STOPHY_API_KEY to go past the free limits. See Rate limits.

The search function

Save this as stophy.ts. It returns up to 5 web results as JSON, and a failed search throws a StophyError.
stophy.ts

Register it as a tool

Run npm install @anthropic-ai/sdk zod and set ANTHROPIC_API_KEY. The tool runner calls your function and returns the final message.