MCP Apps
    Preparing search index...

    Variable RESOURCE_URI_META_KEYConst

    RESOURCE_URI_META_KEY: "ui/resourceUri"

    Metadata key for associating a UI resource URI with a tool.

    MCP servers include this key in tool definition metadata (via tools/list) to indicate which UI resource should be displayed when the tool is called. When hosts see a tool with this metadata, they fetch and render the corresponding App.

    Note: This constant is provided for reference and backwards compatibility. Server developers should use registerAppTool with the _meta.ui.resourceUri format instead. Host developers must check both formats for compatibility.

    // Preferred: Use registerAppTool with nested ui.resourceUri
    registerAppTool(
    server,
    "weather",
    {
    description: "Get weather forecast",
    _meta: {
    ui: { resourceUri: "ui://weather/forecast" },
    },
    },
    handler,
    );
    // Deprecated: Direct use of RESOURCE_URI_META_KEY
    server.registerTool(
    "weather",
    {
    description: "Get weather forecast",
    _meta: {
    [RESOURCE_URI_META_KEY]: "ui://weather/forecast",
    },
    },
    handler,
    );
    // Hosts should check both modern and legacy formats
    const meta = tool._meta;
    const uiMeta = meta?.ui as McpUiToolMeta | undefined;
    const legacyUri = meta?.[RESOURCE_URI_META_KEY] as string | undefined;
    const uiUri = uiMeta?.resourceUri ?? legacyUri;
    if (typeof uiUri === "string" && uiUri.startsWith("ui://")) {
    // Fetch the resource and display the UI
    }