fix: filter template resources from standard resource listing (#528)

- Add filter to exclude resources with template parameters ({}) from resources/list
- Template resources should only appear in resources/templates/list per MCP spec
- Add comprehensive test coverage for resource/template separation
- Update mock transport utilities for better test support

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
Richie Caputo 2025-09-01 12:21:48 -04:00 • committed by Christian Tzolov
commit 2314238469

View file

@ -594,6 +594,7 @@ public class McpAsyncServer {
var resourceList = this.resources.values()
.stream()
.map(McpServerFeatures.AsyncResourceSpecification::resource)
.filter(resource -> !resource.uri().contains("{"))
.toList();
return Mono.just(new McpSchema.ListResourcesResult(resourceList, null));
};
@ -906,4 +907,4 @@ public class McpAsyncServer {
this.protocolVersions = protocolVersions;
}
}
}