AI SDK - AI agent tools
The @tiptap-pro/ai-toolkit-ai-sdk package provides tool definitions you can add to your AI agent built with the AI SDK by Vercel.
The tool calls generated by the model can then be executed using the executeTool method.
Example usage
Install the package.
npm install @tiptap-pro/ai-toolkit-ai-sdkSupply the tool definitions to the tools parameter of the generateText or streamText functions.
import { openai } from '@ai-sdk/openai'
import { streamText } from 'ai'
import { toolDefinitions } from '@tiptap-pro/ai-toolkit-ai-sdk'
const result = streamText({
  model: openai('gpt-5'),
  tools: toolDefinitions(),
})Combine the tool definitions with your custom tools.
import { openai } from '@ai-sdk/openai'
import { streamText, tool } from 'ai'
import { toolDefinitions } from '@tiptap-pro/ai-toolkit-ai-sdk'
import { z } from 'zod'
const result = streamText({
  model: openai('gpt-5'),
  tools: {
    // Tool definitions from the AI Toolkit
    ...toolDefinitions(),
    // Custom weather tool
    weather: tool({
      description: 'Get the weather in a location',
      inputSchema: z.object({
        location: z.string(),
      }),
      execute: async () => ({
        temperature: 72,
      }),
    }),
  },
})Type error with Zod 3
If your app uses version 3 of the Zod validation library, you might get a type
error when you pass the tool definitions to the tools parameter of the generateText or
streamText functions. You can fix it by upgrading to Zod 4 or by type casting the tool
definitions to the ToolSet type of the AI SDK.
API reference
toolDefinitions 
Creates tool definitions for the Tiptap AI Toolkit compatible with Vercel AI SDK.
Parameters (ToolDefinitionsOptions) 
tools?:EnabledTools- Enable/disable specific tools by setting the value totrue(enabled) orfalse(disabled).insertContent?:boolean- Enable/disable theinsertContenttool (default:true)applyPatch?:boolean- Enable/disable theapplyPatchtool (default:true)readNodeRange?:boolean- Enable/disable thereadNodeRangetool (default:true)readSelection?:boolean- Enable/disable thereadSelectiontool (default:true)getThreads?:boolean- Enable/disable thegetThreadstool (default:false)editThreads?:boolean- Enable/disable theeditThreadstool (default:false)
Returns
An object containing the enabled tool definitions that can be used with the Vercel AI SDK's tool calling system. The returned object includes:
insertContent- Tool for inserting HTML content at a specific positionapplyPatch- Tool for applying small precise edits to the documentreadNodeRange- Tool for reading part of the document by specifying a range of top-level nodesreadSelection- Tool for reading the currently selected content in the editorgetThreads- Tool for retrieving all threads and comments in the document (requires Comments extension)editThreads- Tool for performing operations on threads and comments (requires Comments extension)