AI ToolsLast updated on
Last updated on
Integrate OpenForm tools into your own AI applications with framework-specific adapters
The OpenForm AI packages let you add OpenForm tools to your own AI applications. Unlike the MCP server, which is a hosted service, these are npm packages you install and run in your own stack.
Packages
| Package | Description | Install |
|---|---|---|
@open-form/ai-tools | Core tool protocol — schemas, execute functions, registry client | npm install @open-form/ai-tools |
@open-form/ai-sdk | Vercel AI SDK adapter | npm install @open-form/ai-sdk |
@open-form/tanstack-ai | TanStack AI adapter | npm install @open-form/tanstack-ai |
Install the adapter for your framework. Both adapters depend on @open-form/ai-tools internally.
Tools
All adapters expose the same five tools:
| Tool | Description | Network? |
|---|---|---|
validateArtifact | Validate an artifact against the OpenForm schema | Yes* |
fill | Fill a form or checklist with data and validate | Yes* |
render | Render a form to PDF, markdown, or DOCX | Yes* |
getRegistry | Fetch registry.json, returns available artifacts | Yes |
getArtifact | Fetch artifact JSON from a registry by name | Yes |
* validateArtifact, fill, and render all fetch in URL and registry modes. In artifact mode, only render may fetch (file-backed layers use baseUrl to resolve templates).
Quick start
npm install @open-form/ai-sdk ai zodimport { openFormTools } from "@open-form/ai-sdk"
import { generateText } from "ai"
import { openai } from "@ai-sdk/openai"
const result = await generateText({
model: openai("gpt-4o"),
tools: openFormTools({
defaultRegistryUrl: "https://public.open-form.dev",
}),
prompt: "Fill the pet addendum for my dog Rex",
})npm install @open-form/tanstack-ai @tanstack/ai zodimport { openFormTools } from "@open-form/tanstack-ai"
const tools = openFormTools({
defaultRegistryUrl: "https://public.open-form.dev",
})Composing with other tools
openFormTools() returns a plain object. Spread it alongside your own tools:
import { openFormTools } from "@open-form/ai-sdk"
import { tool } from "ai"
const result = await generateText({
model,
tools: {
...openFormTools(),
lookupCustomer: tool({ /* ... */ }),
},
prompt: "...",
})Or cherry-pick individual tools:
const { validateArtifact, render } = openFormTools()
const result = await generateText({
model,
tools: { validateArtifact, render },
prompt: "...",
})Configuration
All adapters accept the same OpenFormToolsConfig:
openFormTools({
defaultRegistryUrl: "https://public.open-form.dev",
proxyTextRenderer: {
url: "https://your-documents-service.example.com",
apiKey: "your-api-key",
},
fetch: customFetchWithAuth,
})| Option | Type | Description |
|---|---|---|
defaultRegistryUrl | string | Default registry URL for getRegistry and getArtifact |
proxyTextRenderer | { url, apiKey } | Edge-compatible proxy for Handlebars text rendering |
fetch | typeof fetch | Custom fetch for auth headers or test mocks |
Edge compatibility
- PDF and DOCX renderers work everywhere (pure JS, no
new Function()) - Text renderer (Handlebars) requires Node.js. On edge runtimes, set
proxyTextRendererto delegate to an HTTP service
Differences from MCP server
| MCP server | AI packages | |
|---|---|---|
| Runs where | Hosted at mcp.open-form.dev | Your own application |
| Protocol | Model Context Protocol | Framework-specific (AI SDK, TanStack) |
| Registry lookup | DB-backed registry IDs | Direct registry URLs |
| Render output | URL (R2 upload) or inline | Inline only |
| Auth | None (public) | Your config (fetch, API keys) |
| Extra tools | list_artifacts, list_registries, search | Not included (require DB) |