From 2991f0d5554dd71410ccb4defe7a4512f4500974 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Thu, 29 May 2025 20:36:04 -0600 Subject: [PATCH] Make ResourceTemplate list callback optional This removes the `| undefined` in exchange for optional because forcing the inclusion of `list` is unnecessary and confusing. https://github.com/modelcontextprotocol/modelcontextprotocol/discussions/586 --- src/server/mcp.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/mcp.ts b/src/server/mcp.ts index 5b864b8b..772470fb 100644 --- a/src/server/mcp.ts +++ b/src/server/mcp.ts @@ -934,9 +934,9 @@ export class ResourceTemplate { uriTemplate: string | UriTemplate, private _callbacks: { /** - * A callback to list all resources matching this template. This is required to specified, even if `undefined`, to avoid accidentally forgetting resource listing. + * A callback to list all resources matching this template. */ - list: ListResourcesCallback | undefined; + list?: ListResourcesCallback; /** * An optional callback to autocomplete variables within the URI template. Useful for clients and users to discover possible values. @@ -944,7 +944,7 @@ export class ResourceTemplate { complete?: { [variable: string]: CompleteResourceTemplateCallback; }; - }, + } = {}, ) { this._uriTemplate = typeof uriTemplate === "string"