Skip to main content
An Interactive Tool exposes one of your UI components to the agent as an MCP tool. Under the hood, it’s a Type backed by a layout component. The model calls it with structured JSON that fills in the component’s fields; Metabind validates the JSON against the tool’s schema and component allowlist, then the component renders: inside the host’s frame in Claude and ChatGPT, and natively in your own apps. This guide walks through building one end to end in Metabind Studio.
Working in code? Your AI coding agent can convert your existing SwiftUI, Jetpack Compose, or React components to BindJS and create the tools with the Metabind CLI. Run metabind skill install to give Claude Code, Cursor, or Codex the Metabind skills first. See CLI workflows.

Prerequisites

1. Author a layout component

A layout component is the BindJS code that:
  • Declares the tool’s input schema (via properties).
  • Defines what the AI is allowed to render (via component allowlists).
  • Renders the validated input as a layout.
A minimal layout component:
For the property schema language and the BindJS layout primitives, see the BindJS Reference.

Add a previews array

Previews are sample inputs that Metabind Studio uses to render the component without an AI call. Always include at least one — it’s how you’ll test changes.

2. Create a Type that points at the component

A Type registers the component with the MCP server. In Metabind Studio:
  1. Open UI Tools in the project sidebar and click + to add one.
  2. Select the layout component you just authored.
  3. Set the Type’s name (becomes the slug, the MCP tool name) and description (becomes the tool description the model reads). See Write tool descriptions.
  4. Save.
The Type’s input schema is auto-generated from the component’s properties. The Type’s name slugifies to lowercase-underscore — Product Detail → product_detail. The slug is immutable after first publish.
The Interactive Tool edit page in Metabind Studio with Tool Name, Title, Description, and Component fields visible

3. Configure allowed components (for layouts that compose children)

If your layout accepts children — for example, a layout that renders a list of arbitrary product cards — declare the allowed children on the property:
The model can only compose the listed components inside components. Any other reference is rejected during schema validation. See Component allowlists.

4. Test the tool inline

In Metabind Studio, click the Type. The center pane shows a live preview; the right pane is the test panel.
  1. Fill the test inputs.
  2. Click Run.
  3. The platform validates your input against the schema, compiles BindJS, resolves the package, and renders the result.
This is the same code path that runs when a model calls the tool from a connected MCP host. To see a model choose and call the tool, use the Playground. See Testing tools.
The product_detail Interactive Tool tested inside Metabind Studio — a live Lounge Chair preview on the left and a populated test panel on the right

5. Write tool descriptions

Tool descriptions are the text the model reads to pick a tool and fill it in. There are two kinds, and both matter:
  • The tool’s description. The Type’s description is the tool’s MCP description, what the model reads when deciding whether to call it. Say when to call it and when not to: “Render a single product detail card. Use when the user wants to view one product in depth, not when comparing multiple products.”
  • Field descriptions. The description on each property becomes the description of that field in the tool’s JSON schema, which tells the model what goes in it: “Price in US dollars, as a number. Don’t include the currency symbol.”
Server instructions, set on the Server tab, sit above both: they tell the model how the project’s tools work together. Every host receives them when it connects. See Project setup. Descriptions guide the model; they don’t bind it. Schema validation still checks every response before it renders.

6. Iterate and refine

A few common refinements once the basic tool works:
  • Add validation to properties. minLength, maxLength, min, max, pattern. Schema violations return clear errors to the model on retry.
  • Constrain allowed components tightly. The smaller the allowlist, the more predictable the model’s output.
  • Update the server instructions to reference the new tool and describe when it should be used.

7. Publish

Once the tool works on the draft endpoint, publish the server to promote it to production.

Authoring BindJS components

Component primitives, modifiers, and the inspector schema.

Component allowlists

Constrain what the AI can render.

Testing tools in Metabind Studio

The test panel, preview gallery, and live device preview.

Tools and Types

Conceptual: how Types become MCP tools.