Replace deprecated RESOURCE_URI_META_KEY with _meta.ui.resourceUri
Update all example servers to use the new recommended metadata format for associating UI resources with tools. The old `RESOURCE_URI_META_KEY` constant is deprecated in favor of the nested `_meta.ui.resourceUri` structure. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7f1c9c0dde
commit
94bc708963
1 changed files with 50 additions and 60 deletions
|
|
@ -4,24 +4,23 @@
|
|||
* Demonstrates serving binary content (video) via MCP resources.
|
||||
* The server fetches videos from CDN and serves them as base64 blobs.
|
||||
*/
|
||||
import {
|
||||
registerAppResource,
|
||||
registerAppTool,
|
||||
RESOURCE_MIME_TYPE,
|
||||
} from "@modelcontextprotocol/ext-apps/server";
|
||||
import {
|
||||
McpServer,
|
||||
ResourceTemplate,
|
||||
} from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import type {
|
||||
CallToolResult,
|
||||
ReadResourceResult,
|
||||
} from "@modelcontextprotocol/sdk/types.js";
|
||||
import { z } from "zod";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import {
|
||||
registerAppTool,
|
||||
registerAppResource,
|
||||
RESOURCE_MIME_TYPE,
|
||||
RESOURCE_URI_META_KEY,
|
||||
} from "@modelcontextprotocol/ext-apps/server";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import { z } from "zod";
|
||||
import { startServer } from "./server-utils.js";
|
||||
|
||||
const DIST_DIR = path.join(import.meta.dirname, "dist");
|
||||
|
|
@ -133,7 +132,7 @@ ${Object.entries(VIDEO_LIBRARY)
|
|||
videoUri: z.string(),
|
||||
description: z.string(),
|
||||
}),
|
||||
_meta: { [RESOURCE_URI_META_KEY]: RESOURCE_URI },
|
||||
_meta: { ui: { resourceUri: RESOURCE_URI } },
|
||||
},
|
||||
async ({ videoId }): Promise<CallToolResult> => {
|
||||
const video = VIDEO_LIBRARY[videoId];
|
||||
|
|
|
|||
Loading…
Reference in a new issue