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
|
|
@ -1,3 +1,8 @@
|
|||
import {
|
||||
RESOURCE_MIME_TYPE,
|
||||
registerAppResource,
|
||||
registerAppTool,
|
||||
} from "@modelcontextprotocol/ext-apps/server";
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import type {
|
||||
|
|
@ -9,12 +14,6 @@ import os from "node:os";
|
|||
import path from "node:path";
|
||||
import si from "systeminformation";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
RESOURCE_MIME_TYPE,
|
||||
RESOURCE_URI_META_KEY,
|
||||
registerAppResource,
|
||||
registerAppTool,
|
||||
} from "@modelcontextprotocol/ext-apps/server";
|
||||
import { startServer } from "./server-utils.js";
|
||||
|
||||
// Schemas - types are derived from these using z.infer
|
||||
|
|
@ -149,7 +148,7 @@ export function createServer(): McpServer {
|
|||
"Returns current system statistics including per-core CPU usage, memory, and system info.",
|
||||
inputSchema: {},
|
||||
outputSchema: SystemStatsSchema.shape,
|
||||
_meta: { [RESOURCE_URI_META_KEY]: resourceUri },
|
||||
_meta: { ui: { resourceUri } },
|
||||
},
|
||||
async (): Promise<CallToolResult> => {
|
||||
const stats = await getStats();
|
||||
|
|
|
|||
Loading…
Reference in a new issue