[ 
https://issues.apache.org/jira/browse/CAMEL-25537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18126980#comment-18126980
 ] 

Federico Mariani commented on CAMEL-25537:
------------------------------------------

Blocked by CAMEL-25639: a review of all 86 tools proposes dropping or folding 
about twenty of them first (subsets, composites with no analysis, copies), so 
the profiles here are defined over the reduced surface.

_Claude Code on behalf of Croway_

> camel-jbang-mcp - every tool is listed to the client: add tool profiles 
> (catalog, runtime, migration, authoring) and an allow-list
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25537
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25537
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jbang-mcp
>    Affects Versions: 4.22.1
>            Reporter: Federico Mariani
>            Priority: Major
>
> camel-jbang-mcp registers every @Tool bean unconditionally, so a client 
> always receives all of them: 73 tools in 4.22.1 (31 of them 
> {{camel_runtime_*}}), 86 on main. Each tool definition (name, description, 
> argument schema) goes into the model's context on every turn, whether the 
> session needs it or not.
> h3. Evidence
> In an evaluation of coding agents (Claude Code and IBM Bob) on 
> legacy-to-Camel migration tasks, using camel-jbang-mcp 4.22.1 via Claude Code 
> 2.1.29x and camel-kit 0.4.1, 218 sessions made 1,729 calls to the server and 
> used 27 of the 73 tools. The catalog tools, {{camel_validate_yaml_dsl}}, 
> {{camel_component_properties}} and {{camel_configuration_validate}} made up 
> 1,688 of those calls (98%). Only 6 of the 31 runtime tools were ever called 
> (processes, routes, send, stop, errors, history: 19 calls in total). Never 
> called in any session: the other 25 {{camel_runtime_*}} tools, 
> {{camel_openapi_*}}, {{camel_dependency_*}}, {{camel_error_diagnose}}, 
> {{camel_transform_route}}, {{camel_version_list}}, the {{camel_ai_*}} tools, 
> {{camel_route_*}} and {{camel_render_route_diagram}}. With the server plus 
> two other MCP servers, Claude Code listed 116 tools to the model.
> h3. Cause
> Every class with {{@Tool}} methods under 
> {{dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/}}
>  is an {{@ApplicationScoped}} bean (e.g. {{RuntimeTools}} has 31 tools at 
> 4.22.1, 41 on main; {{CatalogTools}} 11 at 4.22.1). The only 
> {{io.quarkiverse.mcp.server.ToolFilter}} is {{McpAccessFilter}}, which 
> filters by read-only/destructive hint and only when 
> {{camel.mcp.security.enabled=true}}. There is no option to select tools by 
> purpose.
> CAMEL-24834 (on main, not in 4.22.x) added {{camel_runtime_tool_groups}}, 
> which tells a client which runtime groups (sql, tracing, resilience, http) 
> the selected integration needs. That is advisory: the server still lists 
> every tool, and it covers runtime tools only, not catalog, migration, 
> authoring or the rest.
> h3. Fix
> Let the server expose a subset, selected at startup, through a {{ToolFilter}} 
> next to {{McpAccessFilter}}:
> * Profiles, selectable by a server argument (e.g. {{camel mcp 
> --tools=catalog,migration}} or {{-Dcamel.mcp.tools.profiles=...}}): 
> {{catalog}} (catalog docs and lists, examples, Kamelets, component 
> properties, validation), {{authoring}} (file write/edit, validate, transform, 
> project overview), {{runtime}} (the {{camel_runtime_*}} tools, optionally 
> narrowed further by the groups of CAMEL-24834), {{migration}} (migration 
> guide, analyze, WildFly/Karaf, properties translate). No argument keeps 
> today's behaviour (all tools).
> * An explicit allow-list and deny-list of tool names or globs 
> ({{camel.mcp.tools.include=camel_catalog_*,camel_validate_yaml_dsl}}, 
> {{camel.mcp.tools.exclude=camel_runtime_*}}), so a client such as a project's 
> {{.mcp.json}} can pass exactly what it needs in the server's {{args}}/{{env}}.
> * Optionally, with a client that supports 
> {{notifications/tools/list_changed}}, a tool that enables a profile for the 
> session so the runtime tools are only listed once the agent starts an 
> integration.
> Document the profiles and their tools in camel-jbang-mcp.adoc.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to