orpiske commented on code in PR #25490:
URL: https://github.com/apache/camel/pull/25490#discussion_r3775710454
##########
components/camel-ai/camel-mcp-server-api/src/main/java/org/apache/camel/component/mcp/server/McpServerBridge.java:
##########
@@ -305,19 +303,22 @@ private McpToolCallResult execute(AiToolSpec spec,
Map<String, Object> arguments
}
}
+ private boolean matchesTag(String tag) {
+ return tag != null && PatternHelper.matchPatterns(tag, tagPatterns);
Review Comment:
**Observation (non-blocking):** `PatternHelper.matchPattern()` has a 4-step
cascade: exact (case-insensitive) → `*` → wildcard prefix (`foo*`) → **regex
fallback**. This means a tag pattern like `a.b` would also match `axb` via
regex, which may surprise operators.
Since tags are operator-controlled (not untrusted input), the practical risk
is low. But it might be worth either:
- (a) Documenting the full matching cascade in the `setTags()` Javadoc so
operators know regex is available, or
- (b) Using a restricted matcher that skips the regex step, if regex support
isn't intended for tags.
Also worth noting: the original `Set.contains()` was case-sensitive, while
`PatternHelper.matchPattern()` uses `equalsIgnoreCase()`. A tool tagged `CRM`
now matches a configured tag `crm`. This is arguably more user-friendly, but
it's a behavioral change worth documenting (e.g., "Tag matching is
case-insensitive").
##########
components/camel-ai/camel-mcp-server-api/src/main/java/org/apache/camel/component/mcp/server/McpServerConfiguration.java:
##########
@@ -35,8 +35,9 @@ public class McpServerConfiguration {
private long sessionIdleTtl = McpServerConstants.DEFAULT_SESSION_IDLE_TTL;
/**
- * Comma-separated list of ai-tool tags to expose as MCP tools. Only tools
registered under one of these tags are
- * published; the untagged default pool is never exposed. When not set, no
tools are published.
+ * Comma-separated list of ai-tool tag patterns to expose as MCP tools.
Patterns support exact match, wildcard
+ * prefix ({@code foo*}), and {@code *} to match all tags. Only tools
registered under a matching tag are published;
+ * the untagged default pool is never exposed. When not set, no tools are
published.
Review Comment:
**Suggestion (non-blocking):** Consider mentioning that matching is
case-insensitive and that the regex fallback is also available. This would help
operators understand the full behavior of the tag patterns. Something like:
> Patterns support exact match (case-insensitive), wildcard prefix (`foo*`),
`*` to match all tags, and regular expressions.
--
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]