OpenForm
AI

AI Tools

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

PackageDescriptionInstall
@open-form/ai-toolsCore tool protocol — schemas, execute functions, registry clientnpm install @open-form/ai-tools
@open-form/ai-sdkVercel AI SDK adapternpm install @open-form/ai-sdk
@open-form/tanstack-aiTanStack AI adapternpm 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:

ToolDescriptionNetwork?
validateArtifactValidate an artifact against the OpenForm schemaYes*
fillFill a form or checklist with data and validateYes*
renderRender a form to PDF, markdown, or DOCXYes*
getRegistryFetch registry.json, returns available artifactsYes
getArtifactFetch artifact JSON from a registry by nameYes

* 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 zod
import { 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 zod
import { 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,
})
OptionTypeDescription
defaultRegistryUrlstringDefault registry URL for getRegistry and getArtifact
proxyTextRenderer{ url, apiKey }Edge-compatible proxy for Handlebars text rendering
fetchtypeof fetchCustom 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 proxyTextRenderer to delegate to an HTTP service

Differences from MCP server

MCP serverAI packages
Runs whereHosted at mcp.open-form.devYour own application
ProtocolModel Context ProtocolFramework-specific (AI SDK, TanStack)
Registry lookupDB-backed registry IDsDirect registry URLs
Render outputURL (R2 upload) or inlineInline only
AuthNone (public)Your config (fetch, API keys)
Extra toolslist_artifacts, list_registries, searchNot included (require DB)

On this page