import type { MetaObject } from "@modelcontextprotocol/server"; import type { ViewManifestEntry, ViewResourceFacts } from "./types.js"; /** * Tool declaration `_meta` for `tools/list`. * * When `viewName` is set, emits `ui.resourceUri` plus the legacy flat * {@link UI_RESOURCE_URI_META_KEY} key. When `visibility` is set, emits * `ui.visibility: [visibility]`. Either may be set independently — a * view-less tool can still declare app-only visibility. Returns `undefined` * only when no view, visibility, or existing metadata is provided. * * @param viewName - Bound view directory / manifest key, or `undefined` when * the tool has no view. * @param visibility - Optional model/app visibility narrowing from the tool * definition's top-level `visibility` field. * @param existingMetadata - Optional author-supplied definition metadata. Other * keys pass through, while framework-owned resource URI and visibility keys * are derived exclusively from `viewName`, `buildId`, and `visibility`. * @param buildId - Immutable production build ID; omit in development. * @returns Wire metadata for the tool listing, or `undefined` when there is * nothing to emit. */ export declare function buildToolUiMeta(viewName: string | undefined, visibility: "model" | "app" | undefined, existingMetadata?: MetaObject, buildId?: string): MetaObject | undefined; /** * Tool result `_meta` stamped on completed non-error `CallToolResult` values * from a view-bound tool. * * Emits the nested `ui.resourceUri` key and the legacy flat * {@link UI_RESOURCE_URI_META_KEY} key so hosts can open the bound view. * Error results (`isError: true`) and intermediate `input_required` returns * must not receive this metadata. A stamped error URI would create a new * rendered view through legacy host behavior. Result `_meta` is view-only and * never enters model context. * * @param viewName - Bound view directory / registry key. * @param buildId - Immutable production build ID; omit in development. * @returns Nested and legacy resource-URI wire keys. */ export declare function buildToolResultUiMeta(viewName: string, buildId?: string): Record; /** * Options for {@link buildResourceUiMeta}. * * @internal */ export interface BuildResourceUiMetaOptions { /** Request used to resolve server/assets origins when not passed explicitly. */ request?: Request; /** Explicit server origin (overrides request resolution). */ serverOrigin?: string; /** Explicit assets URL prefix (overrides request resolution). */ assetsBase?: string; /** * When true, append the server origin's websocket variant to * `csp.connectDomains` for Vite HMR under host-enforced CSP. */ hmrWs?: boolean; } /** * Resource metadata for a primed view, including `_meta.ui` and the * OpenAI widget-description and display-mode extensions. * * Emits `csp` by merging author `view.csp`, env (`CSP_URLS` / `CSP_*_DOMAINS`), * and MCP auto-append (`MCP_URL` → connect; assets origin → resource). */ export declare function buildResourceUiMeta(authorFacts: ViewResourceFacts | undefined, options?: BuildResourceUiMetaOptions): Record; /** * Listing metadata for a primed view resource. */ export declare function viewResourceConfig(_viewName: string, _entry: ViewManifestEntry, authorFacts: ViewResourceFacts | undefined, options?: BuildResourceUiMetaOptions): { mimeType: string; description?: string; _meta: Record; };