[
https://issues.apache.org/jira/browse/CAMEL-25537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18126987#comment-18126987
]
Federico Mariani commented on CAMEL-25537:
------------------------------------------
Host facts from a check of the agent hosts' sources and docs (2026-10-14),
which change what this issue buys where:
|| Host || Tool schemas at session start || How the model reaches a tool ||
Server {{instructions}} ||
| Claude Code 2.1.29x | deferred: tool names only ({{ENABLE_TOOL_SEARCH}} unset
= always defer; {{auto}} = defer above 10% of the context) | ToolSearch
{{select:<name>}}: 113 such calls in the evaluation, every one by name | loaded
at session start, up to 4096 characters |
| Codex CLI (main, 2026-10-14) | deferred: tool search is on by default
({{core/tests/suite/search_tool.rs}}, {{mcp_tool_exposure.rs:84}}) |
tool_search | read from {{initialize}}, used as server-wide guidance; the first
512 characters matter most; {{enabled_tools}}/{{disabled_tools}} per server on
the client side |
| OpenCode (main, 2026-10-14) | code mode by default: tools are not declared,
the prompt carries one catalog line per tool | an {{execute}} script calling
{{tools["<server>"]}} | full text in an {{<mcp_instructions>}} block, re-sent
when it changes |
| Pi (main, 2026-10-14) | {{codemode}} by default (scripts use
{{searchTools()}}), {{deferred}} via tool_search, {{direct}} per tool | scripts
or tool_search | only the FIRST LINE reaches the system prompt; the full text
through {{describeNamespace()}} in scripts |
| Bob Shell 2.0.5 | all schemas up front (995 evaluation calls, no search step)
| direct | not documented |
So on Claude Code, Codex and Pi the 86-tool list costs the names only: the
first model call of a Claude Code session with the server was 6.9K tokens
against 4.8K without it (mean over 45 Haiku trials, the same for Sonnet), about
2K tokens for 86 names. Codex and Pi also already have a client-side allow-list
and per-tool exposure. The full schema set is in the context on Bob (all 73
schemas at 4.22.1) and, as one catalog line per tool, on OpenCode and Pi code
mode; that is where profiles save tokens. The other value of profiles holds
everywhere: a shorter name list is easier to pick from by name, which is how
the deferred hosts select a tool (113 ToolSearch calls in the evaluation, every
one by name). The allow-list half of this issue is therefore mostly for Bob and
for the TUI; the profile half should also drive the instructions text of
CAMEL-25646 (the tools of the active profile are the ones to name there).
_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)