Nimble Web Search — Mastra tool
Copy this into a Mastra agent to give it Nimble web search.
Claude Code
Codex
OpenCode
Cursor
Cline
Add Nimble web search to this Mastra project. 1. Create `src/tools/nimble-web-search.ts`: a Mastra tool (`createTool`) that calls Nimble's Web Search Agent — `POST https://sdk.nimbleway.com/v2/search` with header `Authorization: Bearer $NIMBLE_API_KEY` — with a 15s timeout and a typed error on failure. Return `{ answer, sources }`. 2. Register it on an agent: ```ts import { Agent } from "@mastra/core/agent"; import { anthropic } from "@ai-sdk/anthropic"; import { nimbleWebSearchTool } from "./tools/nimble-web-search"; const agent = new Agent({ name: "research-agent", instructions: "Use nimble-web-search for anything needing current information, and cite sources.", model: anthropic("claude-sonnet-5"), tools: { nimbleWebSearchTool }, }); const result = await agent.generate("What is PydanticAI?"); console.log(result.text); ``` 3. Add `NIMBLE_API_KEY` to `.env`. Follow this repo's CLAUDE.md if one exists, and run the tests after wiring it in.
Copy prompt for Claude Code
My process