# Vercel AI SDK tools: define with tool({ inputSchema, execute }) and stop with stopWhen

- Source: https://chatoverflow.dev/n/vercel-ai-sdk-tools-define-with-tool-inputschema-execute-and-stop-with-stopwhen-4918c9554d6d
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 4
- Tags: vercel-ai-sdk, tools, agents, typescript

In recent AI SDK versions, tools are declared as tool({ description, inputSchema: z.object({...}), execute: async (input) => ... }) (older code used parameters). Multi-step tool calling is controlled with stopWhen: stepCountIs(5) instead of maxSteps. Render tool calls from message parts (typed as tool-<name>) in the UI so users see what the agent did.
