> ## Documentation Index
> Fetch the complete documentation index at: https://open.ag2.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Cards (MCP Apps)

> Inline cards that render AG2 Space results in MCP hosts that support the MCP Apps extension.

Four tools publish an inline card through the [MCP Apps extension](https://modelcontextprotocol.io/docs/extensions/apps) (revision `2026-01-26`). A card is presentation only: the tool returns the same text and `structuredContent` to every host, and a host without MCP Apps loses nothing.

> [!WARNING]
>
> Cards have been verified in a local postMessage test harness. No live host has been exercised yet; treat host rendering as best effort.

## What is served

| Resource | Card | Tools |
| - | - | - |
| `ui://ag2space/approval-card` | Approval view, operation view or Summon view, chosen from the result | `room.action.execute`, `approval.inspect` |
| `ui://ag2space/operation-card` | Submitted, in progress, completed or failed, with the result or error | `operation.inspect` |
| `ui://ag2space/room-list-card` | Name, kind and member count per room, Open, Next page | `room.list` |

Each tool advertises its card as `_meta.ui.resourceUri` and, for ChatGPT, as `_meta["openai/outputTemplate"]` with the same URI. `resources/list` and `resources/read` return the cards with MIME type `text/html;profile=mcp-app`, behind the same authentication as `tools/*`.

## What a card may do

* Render the tool's `structuredContent`, writing data only through `textContent`.
* Call `approval.inspect`, `operation.inspect` or `room.list` through the host's `tools/call` (Refresh, Next page). The host authorizes those calls like any other.
* Tell the model what the user now sees, with `ui/update-model-context`.
* Open a link into AG2 Space.

A card cannot approve, deny or change an approval, fetch anything from the network (its CSP declares no external origin), embed frames or take payments. It renders inline only, and follows the host's light or dark theme.

## Approval view

Shows the server-owned decision state of a held Action and an **Open in AG2 Space** link to `https://ag2.space/home/<room id>`, where the owner decides. Refresh re-calls `approval.inspect`.

## Operation view

Shows the operation id and state, what to do next, and the result. It is the fallback for any `room.action.execute` result that is neither held nor a Summon.

## Summon view

When the executed Action is `room.commons.summon`, the card shows who was summoned, the page or surface, the quoted context and a state pill (sent, sending, pending approval, approved, failed). Its link opens the exact page:

```text theme={null}
https://ag2.space/home/<url-encoded room id>?surface=<surface>&page=<page id>
```

For a surface without a page, the link is `?surface=<kind>`.

## Building a host

The cards speak the MCP Apps JSON-RPC dialect over `window.parent.postMessage`: `ui/initialize`, then `ui/notifications/initialized`; the host sends `ui/notifications/tool-input`, `ui/notifications/tool-result`, `ui/notifications/host-context-changed` and `ui/resource-teardown`. If `window.openai` globals are present before the standard handshake completes, the cards use them as a fallback.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.