From 4a7d8ef2c9190f49f2cfab6334abc57f98f60df9 Mon Sep 17 00:00:00 2001 From: Jeremy Schoemaker Date: Fri, 31 Jul 2026 14:50:35 -0500 Subject: [PATCH] fix(conformance): don't return a resource template from resources/list The everything-server listed "test://template/{id}" in its resources/list response. Two problems: - resources/list is specified to return direct resources; templates belong in resources/templates/list. - "{id}" is not a valid URI, so the response failed the spec's JSON schema check on ListResourcesResult/resources/N/uri (format: "uri"). There was no ListResourceTemplates handler registered at all, so the template was never reachable at its correct endpoint either. Moves the template to a resources/templates/list handler. The ReadResource handler already understood the test://template/ prefix, so template reads are unaffected. Verified against the official conformance runner on macOS 26 / arm64, Swift 6.2.4: before 67 passed, 2 failed (resources-list, elicitation-sep1330-enums) after 68 passed, 1 failed (elicitation-sep1330-enums) --- Sources/MCPConformance/Server/main.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/MCPConformance/Server/main.swift b/Sources/MCPConformance/Server/main.swift index 6a7ccead..16916148 100644 --- a/Sources/MCPConformance/Server/main.swift +++ b/Sources/MCPConformance/Server/main.swift @@ -376,7 +376,12 @@ func createConformanceServer(state: ServerState, transport: StatefulHTTPServerTr Resource(name: "Static Text Resource", uri: "test://static-text", description: "A simple static text resource", mimeType: "text/plain"), Resource(name: "Static Binary Resource", uri: "test://static-binary", description: "A simple static binary resource", mimeType: "application/octet-stream"), Resource(name: "Watched Resource", uri: "test://watched", description: "A resource that can be subscribed to for updates", mimeType: "text/plain"), - Resource(name: "Template Resource", uri: "test://template/{id}", description: "A resource template with URI parameters", mimeType: "text/plain"), + ]) + } + + await server.withMethodHandler(ListResourceTemplates.self) { _ in + .init(templates: [ + Resource.Template(uriTemplate: "test://template/{id}", name: "Template Resource", description: "A resource template with URI parameters", mimeType: "text/plain") ]) }