Loading preview…
Loading preview…
Create dynamic tools with runtime-generated schemas using dynamicTool. Demonstrates unit conversion tools where schema adapts based on conversion type (temperature, length, weight, currency) and supports dynamic model selection.
Loading preview…
Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in — then wire env vars and routes the same way.
Install from the preview toolbar
Copy the install command above and run it in your project — Pro patterns include a short-lived token.
Add environment variables to .env.local
OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY
Point client fetches at your API routes
Replace preview `/view/.../api/...` paths with `/api/...` in the installed files.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions for your product — Copy for AI in the toolbar helps seed that work.
Run your dev server and open the pattern route
Install dependencies if needed, then start the app and verify responses.
AI SDK APIs
streamTextconvertToModelMessagesdynamicTooluseChatprepareSendMessagesRequestProviders
app/page.tsxapp/layout.tsxapp/api/dynamic-tool/route.tscomponents/dynamic-tool-demo.tsxcomponents/converter-config-form.tsx/tools/dynamic-tool-executor.ts/tools/dynamic-tool-ui.tsxnpm packages
10
Registry components
tools/dynamic-tool-executor.tsCore dynamic tool creation logic using dynamicTool(). Creates tools at runtime based on conversion type — dynamically generates tool name, description, Zod inputSchema, and execute function.
dynamic-tool/route.tsAPI route demonstrating runtime tool configuration. Receives toolConfig from the client, validates it, calls createDynamicConverterTool, and passes to streamText.
Early-bird pricing — limited time

Open on desktop for the interactive preview.
Create dynamic tools with runtime-generated schemas using dynamicTool. Demonstrates unit conversion tools where schema adapts based on conversion type (temperature, length, weight, currency) and supports dynamic model selection.

All patterns include interactive previews and complete source files.
What you unlock: