ramu11 commented on code in PR #9509:
URL: https://github.com/apache/camel-quarkus/pull/9509#discussion_r4588159399
##########
extensions/mcp-server/runtime/src/main/java/org/apache/camel/quarkus/component/mcp/server/QuarkusMcpServerEngine.java:
##########
@@ -191,6 +265,357 @@ public boolean supportsResources() {
return true;
}
+ @Override
+ public void resourceTemplateAdded(McpServerResourceTemplate
resourceTemplate) {
+ AiResourceUriTemplate matcher;
+ try {
+ matcher = new
AiResourceUriTemplate(resourceTemplate.uriTemplate());
+ } catch (IllegalArgumentException e) {
+ throw new McpServerRefusedException(
+ "Unsupported MCP resource template '" +
resourceTemplate.uriTemplate() + "'", e);
+ }
+
+ // Retry cleanup if a previous route stop failed to remove this
template.
+ try {
+ removeRegisteredResourceTemplate(resourceTemplate.uriTemplate());
+ } catch (Exception e) {
+ throw new McpServerRefusedException(
+ "Previously registered MCP resource template '" +
resourceTemplate.uriTemplate()
+ + "' could not be removed before re-registration",
+ e);
+ }
+
+ // A template must not shadow an application-defined resource or
another application-defined template on the
+ // default MCP server. Definitions on other MCP servers are
independent and must remain untouched.
+ for (ResourceManager.ResourceInfo existing : resourceManager) {
Review Comment:
Addressed. Removed the check that rejected a resource template when it
matched an existing static resource on the default MCP server. Static resources
and resource templates can now coexist; quarkus-mcp-server resolves an exact
static resource URI before attempting template matching.
Retained the template-vs-template overlap check because multiple matching
templates make resource reads ambiguous in quarkus-mcp-server.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]