/** * MCP Apps widget registration. * * Two HTML resources: the search tools point at an interactive Trefferliste, * `ris_dokument` at a document viewer. Registering them switches the * `resources` capability on in the initialize handshake; non-UI clients simply * ignore both. */ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; /** URI of the Trefferliste widget, referenced by every search tool. */ export declare const SEARCH_WIDGET_RESOURCE_URI = "ui://ris-mcp/trefferliste"; /** URI of the document viewer, referenced by `ris_dokument`. */ export declare const VIEWER_WIDGET_RESOURCE_URI = "ui://ris-mcp/viewer"; /** * UI metadata for the search tools. * * `csp` and `permissions` deliberately do not appear here: `McpUiToolMeta` * types both as `never` because hosts read them from the resource and ignore * them on the tool. `registerAppTool` mirrors `resourceUri` onto the legacy * flat `ui/resourceUri` key for older hosts. * * `openai/widgetAccessible` is ChatGPT's own gate for tool calls the widget * issues itself — the pagination buttons. The standard field for that is * `_meta.ui.visibility`, which defaults to `["model", "app"]` and therefore * already grants it (ext-apps `McpUiToolMeta.visibility`), but ChatGPT's * compatibility field defaults to `false` and is documented as the one * "existing UI integrations" use ("`_meta` fields on tool descriptor", * developers.openai.com/plugins/reference). Hosts that do not know the key * ignore it, so the standard path stays untouched. */ export declare const SEARCH_WIDGET_META: { ui: { resourceUri: string; }; 'openai/widgetAccessible': boolean; }; /** * UI metadata for the document viewer's chunk tool. * * `visibility: ["app"]` is the standard way to say "only the app may call this, * the model must not see it" (ext-apps `McpUiToolMeta.visibility`, default * `["model", "app"]`). It is a declaration, not an enforcement: nothing in the * SDK or ext-apps removes the tool from `tools/list`, so a host that does not * know the key shows it to the model like any other tool. That is survivable * here — the tool answers a model call with real document text — but it is why * its description points at `ris_dokument` instead. * * `openai/widgetAccessible` is ChatGPT's own gate for widget-initiated calls and * defaults to `false`; without it the viewer could not load a single further * section there. * * No `resourceUri`: this tool feeds the viewer that is already open, it does not * open one. Pointing it at the resource would invite hosts to render a fresh * widget per section. */ export declare const DOCUMENT_CHUNK_META: { ui: { visibility: string[]; }; 'openai/widgetAccessible': boolean; }; /** * UI metadata for `ris_dokument`. * * No `openai/widgetAccessible`: that flag gates the calls a widget issues * *itself*, and the viewer never calls `ris_dokument` — it loads further * sections through `ris_dokument_abschnitt`, which carries the flag. Putting it * here would grant an access nothing uses. * * Attaching this changes the `tools/list` entry and nothing else: * `registerAppTool` normalises `_meta` and hands the handler through untouched, * so the tool's response stays byte for byte what it was. */ export declare const VIEWER_WIDGET_META: { ui: { resourceUri: string; }; }; /** * Register the widget resources on the given MCP server. * * Hosts read the CSP from the `resources/read` content item and fall back to * the `resources/list` entry, so both carry the same declaration. */ export declare function registerWidgetResources(server: McpServer): void; //# sourceMappingURL=widgets.d.ts.map