Prompt Buddy logoPrompt Buddy

vercel · Vercel AI SDK Docs

AI SDK Foundations: Tools

Explains how to define and implement tool calling within the AI SDK, allowing models to interact with external functions and structured data.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

AI SDK Foundations: Tools

Explains how to define and implement tool calling within the AI SDK, allowing models to interact with external functions and structured data.

When To Use

Use when you need to enable an LLM to execute specific functions, call external APIs, or interact with your application's internal logic during a conversation.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/ai-sdk-foundations-tools-workflow-guide.mdA guide explaining the concept, types, and implementation of custom and provider-defined tools within the Vercel AI SDK.Questions about a guide explaining the concept, types, and implementation of custom and provider-defined tools within the Vercel AI SDK.
examples/ai-sdk-foundations-tools-ai-sdk-tools-definition-typescript.textA TypeScript code example demonstrating how to define a tool using the AI SDK tool function and Zod schema.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to define a tool using the AI SDK tool function and Zod schema.
examples/ai-sdk-foundations-tools-ai-sdk-tools-generatetext-anthropic.textA TypeScript code example demonstrating how to use the AI SDK generateText function with Anthropic model tool calling.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to use the AI SDK generateText function with Anthropic model tool calling.
examples/ai-sdk-foundations-tools-ai-sdk-tools-generate.textA TypeScript code example demonstrating how to use the generateText function with tool definitions in the AI SDK.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to use the generateText function with tool definitions in the AI SDK.
examples/ai-sdk-foundations-tools-installation-command.textThe shell command required to install a tool package using pnpm for the AI SDK.Exact payloads, commands, or snippets shown in The shell command required to install a tool package using pnpm for the AI SDK.
examples/ai-sdk-foundations-tools-ai-sdk-tools-generate-2.textA TypeScript code example demonstrating how to use the generateText function with a tools object to enable model tool calling.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to use the generateText function with a tools object to enable model tool...
examples/ai-sdk-foundations-tools-ai-sdk-tools-typescript-definition.textA TypeScript code example demonstrating how to define a tool using the tool function and zod schema from the AI SDK.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to define a tool using the tool function and zod schema from the AI SDK.

What This Skill Covers

  • While large language models (LLMs) have incredible generation capabilities, they struggle with discrete tasks (e.g. mathematics) and interacting with the out...
  • Main sections: What is a tool?, Types of Tools, Custom Tools, Provider-Defined Tools, Provider-Executed Tools.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://ai-sdk.dev/docs/foundations/tools