CAMEL-23964: camel-openai - Add per-server MCP tool filtering via toolNames - #25209
Merged
Conversation
…lNames Add a per-server toolNames include list to restrict which MCP tools are registered from each server. This reduces prompt size/cost, keeps destructive tools away from the model, and avoids duplicate tool names across servers. Configuration: mcpServer.<name>.toolNames=tool1,tool2 (comma-separated) The filter is applied consistently in both initializeMcpServers() and doReconnectMcpServer() so the tool set remains stable across connection recovery. When toolNames is not set or empty, all tools are registered (backward compatible). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 11 tested, 27 compile-only — current: 10 all testedMaveniverse Scalpel detected 38 affected modules (current approach: 10).
|
apupier
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a per-server
toolNamesinclude list to thecamel-openaiMCP server configuration, allowing users to restrict which tools are registered from each MCP server.Motivation: Currently,
camel-openairegisters all tools from every configured MCP server. Users need filtering to:Configuration:
When
toolNamesis set, only the listed tools are registered. When not set or empty, all tools are registered (backward compatible).Changes
OpenAIEndpoint.java— AddedfilterTools()helper method that parses the per-servertoolNamesinclude list and filters tools. Applied in bothinitializeMcpServers()anddoReconnectMcpServer()for consistent behavior across initial startup and connection recovery.OpenAIConfiguration.java— UpdatedmcpServermetadata description to document thetoolNamessub-property.openai-mcp.adoc— Added "Tool Filtering" documentation section with Java, XML, and YAML examples.OpenAIEndpointMcpToolFilteringTest.java— 9 new unit tests covering: basic filtering, no filter (all tools), empty filter, whitespace trimming, multiple servers with different filters, mixed filtered/unfiltered servers, reconnect filter persistence, single tool filter, andreturnDirectinteraction with filtering.openai.json— Regenerated component metadata (auto-generated).Test plan
mvn -Psourcecheck validate) passesClaude Code on behalf of gnodet
🤖 Generated with Claude Code