Merge pull request #274 from matteo8p/use-tool-type-from-official-sdk

Use `Tool` as the input type in `getToolUiResourceUri`
This commit is contained in:
Anton Pidkuiko 2026-01-15 11:45:46 +00:00 • committed by GitHub
commit dbc7a41550
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,6 +31,7 @@ import {
ReadResourceResultSchema,
ResourceListChangedNotification,
ResourceListChangedNotificationSchema,
Tool,
ToolListChangedNotification,
ToolListChangedNotificationSchema,
} from "@modelcontextprotocol/sdk/types.js";
@ -107,9 +108,7 @@ export { PostMessageTransport } from "./message-transport";
* });
* ```
*/
export function getToolUiResourceUri(tool: {
_meta?: Record<string, unknown>;
}): string | undefined {
export function getToolUiResourceUri(tool: Partial<Tool>): string | undefined {
// Try new nested format first: _meta.ui.resourceUri
const uiMeta = tool._meta?.ui as { resourceUri?: unknown } | undefined;
let uri: unknown = uiMeta?.resourceUri;