How do I give a tool its own interactive card?

Any tool's output can get its own interactive card: a small HTML page Irene shows in the chat instead of raw data. That includes your own toolkits, connected apps like Gmail, and any MCP server. Irene writes the card, attaches it to the tool by name, and from then on every result from that tool appears as that card. A card can even call its tool again, a Refresh button for example, without ever holding your login.

What makes it different

what it does the primitive behind it what that buys you
One mechanism for every tool A card is matched to a tool by its name when the result arrives, whether it's your toolkit, a connected app or an MCP server Raw data from any app can become a real interface
Cards can act, without your login The card runs in a locked-down frame with no session. When it calls its tool, the app makes the call for it, and only for the tools the card declared A Refresh or Mark as read button works, and can't touch anything else
Can't leak what it shows Cards can't reach the network at all: no fetch, no outside images, no outside scripts Even a card someone shared with you can't send your data anywhere
Built from real output sample calls the tool once and shows its actual output, trimmed to its shape. The card is written against that The card reads the right fields the first time
Debuggable by Irene A card reports its own errors; Irene reads them with errors, fixes the file and re-attaches Broken cards get fixed in the same chat
MCP widgets just work An MCP tool that ships its own interface (MCP Apps) is shown in the same safe frame, with nothing to author Widgets from MCP servers appear as their makers intended

How it works

The loop

  1. See the shape: Irene checks the tool's declared output. If it isn't declared, toolsmith(action="sample", tool=…, args=…) calls the tool once with harmless inputs and returns a trimmed sample: 3 items per list, 400 characters per text, 6 levels deep. It also gives the exact path to each field.
  2. Write the card: an HTML file, written with the file tools.
  3. Attach it: toolsmith(action="view", tool=…, html_path=…). One card can serve several tools that return the same shape.
  4. Run the tool and look. If the card is blank, toolsmith(action="errors") shows its errors. Irene edits the file and attaches it again.

Why a file, not HTML in the chat: big cards stay out of the conversation, and the fix loop is just read the error → edit the file → attach again.

Why sampling trims: a full result, like a page of emails with their HTML, can overflow the conversation. The card only needs the field names and a couple of values, and the live card still gets the full result.

Where cards live

~/.irene/toolkits/<your toolkit>/views/<view>/
  index.html
  view.json        {"tool": "get_quotes"}  or  {"tools": ["a", "b"]}
                   plus "callable": ["c"] for a tool the card calls
                   but whose result should not draw a card itself

Cards made with view for other tools are saved as their own folders under ~/.irene/toolkits/, and come back after a restart.

Who may attach a card to which tool

  • A toolkit's own cards can only show that toolkit's tools — the same holds for a tool the card merely calls. A card that names another toolkit's tool is skipped. Why: a toolkit must not take over another tool's display, or its ability to call that tool.
  • Cards attached with toolsmith(action="view") may show any tool, including Gmail, Slack or an MCP server's tools. Attaching one is itself an approved action.
  • If two cards claim the same tool name, the last one attached wins.

Inside the card

The card gets a small Irene object:

call does
Irene.onInit((result, args) => …) receives the tool's result (already parsed, even when an app returns JSON as text)
Irene.callTool(name, params) call a tool the card declared, through the app (30-second timeout)
Irene.on(event, cb) react to later events in the chat, like a new result
Irene.resize() fit the frame to the content
Irene.logError(msg) report an error for Irene to read
Irene.copyText · Irene.openUrl · Irene.fileUrl · Irene.renderImage copy, open a link (you're asked first), show a local file or image

What a card can and can't do

can can't
show the result, styled with the app's fonts and theme reach the network: no fetch, no outside images or scripts
call the tools it declared call any other tool
follow new results as they arrive read your session or the app's page
open a link, after you confirm open pop-ups

Why so locked down: a card runs against your live tools and data, and might have been written by someone else. Its only power is a short-lived pass the app issues for exactly the tools it named (valid 24 hours).

No card?

Tools without a card show a typed card if Irene has one for that tool. Otherwise you get a clean generic view of the result: errors, lists and fields, never a raw JSON dump.

A real one

gmail_inbox is a card that turns your Gmail connector's results into an inbox, with a Refresh button. The button calls the same Gmail tool again to fetch the latest 15 emails, and reports to Irene if the refresh fails. market_quotes has three cards: quotes, history and a market snapshot.

Approvals

  • A card's tool calls go through the normal approval gate, just like the agent's own. Outside auto mode you're asked, and in auto mode the call is judged like any other. That holds even when no chat turn is running.
  • Writing and attaching a card are normal file and toolsmith actions, approved like any other.
  • Sampling makes a real call, so only read-only tools should be sampled.

Where you see it

  • In the chat, a tool with a card shows it inside the step, marked "custom toolkit · sandboxed" or "mcp ui · sandboxed". It's open by default and keeps its state when collapsed.
  • Agents you deploy show the same cards on their own chat page.
  • Built-in skills: giving-a-tool-a-ui, building-tools (Capabilities → Skills).

Limits

  • No network from a card. Everything it shows comes from the tool's result or its own tool calls.
  • 30 seconds per call from a card.
  • Frame height: up to 1,400 px for a tool card.
  • Card errors are kept in memory, 50 per toolkit, and only Irene reads them.

What it costs

  • Making and showing a card is free. It's a local file.
  • A card's tool calls cost whatever that tool costs (a paid connector call or a media render, for example). They use no model.
  • Designing it is normal chat usage.

[Ask Irene about this]

Updated