AI tools

Adapters

Last updated on

What the Vercel AI SDK, TanStack AI, and Mastra adapters export

Each adapter wraps @paradoc/ai-tools in the tool type of one framework. The tools, their inputs and outputs, and the configuration are the same in every adapter. To start, see the Quickstart.

PackageFrameworkPeer dependenciesNode.js
@paradoc/ai-sdkVercel AI SDK 7ai ^7.0.94, zod ^4.1.1222 or newer
@paradoc/tanstack-aiTanStack AI@tanstack/ai 0.53.0 (exact), zod ^4.1.1222 or newer
@paradoc/mastraMastra@mastra/core ^1.64.0, zod ^4.1.1222.13 or newer

Common exports

Every adapter exports:

ExportDescription
paradocTools(config?)All ten tools. The shape depends on the framework (see below).
One factory per toolgetRegistry, getArtifact, inspectArtifact, validateArtifact, validateInput, fill, getFillState, updateFill, render, extract. Each takes the same optional config.
operationNamesThe ten tool names, in order
createToolExecutionContext(options?)A cache and abort signal for one request. See Request context.
TypesParadocToolsConfig, and the input and output type of every tool, such as FillInput, FillOutput, RenderOutput, FillTarget, and FillItemState

Every factory is also the default export of its own subpath, such as @paradoc/ai-sdk/get-fill-state. A subpath import loads one tool without the others.

ToolFactorySubpath
get_registrygetRegistry()/get-registry
get_artifactgetArtifact()/get-artifact
inspect_artifactinspectArtifact()/inspect-artifact
validate_artifactvalidateArtifact()/validate-artifact
validate_inputvalidateInput()/validate-input
fillfill()/fill
get_fill_stategetFillState()/get-fill-state
update_fillupdateFill()/update-fill
renderrender()/render
extractextract()/extract

Every adapter joins the framework's abort signal to signal and context.signal from the config, sends the model a copy of each result bounded by maxOutputBytes, and gives application code the full result.

@paradoc/ai-sdk

paradocTools() returns a ParadocToolSet: an object of ten AI SDK tools, keyed by tool name. Pass it as tools to generateText, streamText, or ToolLoopAgent.

import { paradocTools } from "@paradoc/ai-sdk"

const tools = { ...paradocTools(config), lookup_customer }
const { fill, get_fill_state } = paradocTools(config)

generateText and streamText stop after one step by default. Set stopWhen, such as isStepCount(10), so the model can call several tools.

Other exports: the ParadocTool<Name> type, and the OperationName and ToolDefinitions types.

@paradoc/tanstack-ai

paradocTools() returns a ParadocToolSet: a readonly array of ten server tools, in the order of operationNames. Pass it as tools to chat(), or spread it into your own array.

import { paradocTools, fill, getFillState } from "@paradoc/tanstack-ai"

const tools = [...paradocTools(config), lookupCustomer]
const fewer = [fill(config), getFillState(config)]

chat() runs up to five model turns by default. Set agentLoopStrategy, such as maxIterations(10), for longer tasks.

Definitions without execution

paradocToolDefinitions() returns the ten tool definitions, with names and schemas but no execution. Use them where a client needs the tool metadata, then make each one a client or server tool with TanStack AI's .client() or .server():

import { paradocToolDefinitions } from "@paradoc/tanstack-ai"

const clientTools = paradocToolDefinitions().map((definition) => definition.client())

Each tool also has its own definition function, such as renderDefinition(), exported from the package root and from the tool's subpath.

Other exports: the ParadocToolDefinition<Name>, ParadocServerTool<Name>, ParadocToolDefinitions, OperationName, and ToolDefinitions types.

@paradoc/mastra

paradocTools() returns an object of ten Mastra tools, keyed by tool name. Each tool's Mastra id is the same name. Pass it as tools to a Mastra Agent.

import { paradocTools } from "@paradoc/mastra"

const { inspect_artifact, fill, get_fill_state, update_fill } = paradocTools(config)

agent.generate() takes maxSteps, the number of tool calls the agent can make in one run.

The tools set strict: false. Mastra's strict-schema layers would close the free-form JSON inputs, such as data, so OpenAI models could not send form data. Each tool validates its input itself.

Other exports: DEFAULT_MODEL_OUTPUT_MAX_BYTES (16,384), and the ParadocMastraConfig type, which is the same as ParadocToolsConfig.

On this page