davsclaus opened a new pull request, #29911: URL: https://github.com/apache/camel/pull/29911
Item 1 of [CAMEL-26932](https://issues.apache.org/jira/browse/CAMEL-26932). ## Problem The `camel_runtime_*` tools of the MCP server pick their integration by `nameOrPid`. `camel_run`, `camel_get_log`, `camel_get_errors`, `camel_control` and `camel_eval_expression` take `name` instead, so agents carry `name` over to the runtime tools. Such a call had `name` ignored and acted on the only integration that runs: ``` camel_runtime_routes {"name":"nosuch"} {"argumentNote":"ignored: name; camel_runtime_routes takes nameOrPid","routes":[{"routeId":"route1",... ``` The same path serves route control, send, receive, SQL, HTTP requests and chaos. So an agent could change another app than the one it meant, including the user's own. In `camel_runtime_heap_dump`, `name` was the file name of the dump. ## Change - **Aliases.** A tool that takes `nameOrPid` also takes the integration as `name`, `pid` or `integration`. `camel_get_log`, `camel_get_errors`, `camel_control` and `camel_eval_expression` also take it as `nameOrPid`, `pid` or `integration`. This uses the existing alias mechanism (`ToolArgumentAliases`), so the answer notes the declared name, and `camel ask` resolves the same way. The declared argument always wins, and tools where `name` means something else (`camel_catalog_doc`, `camel_run`) are left alone. - **Refusal.** Some calls name the integration with an argument the tool ignores (`process`, `app`, `context`, `integrationName`, ...) and do not give the tool's own argument. These are now refused with a message saying which argument to use, instead of running against the one integration that runs. - **Heap dump.** `camel_runtime_heap_dump`'s file-name argument is renamed from `name` to `file`, so `name` names the integration as on every other runtime tool. This is in the 4.24 upgrade guide. - **Docs.** `camel-jbang-mcp.adoc` describes the accepted names. ## Tests - `ToolArgumentAliasesTest`: the aliases, and the ignored-selector check. - `McpArgumentGuardrailTest`: against the real tool definitions. Without the fix, both new tests fail. - End to end, over stdio, against the runner jar, with one integration `orders` running in an isolated home: | call | main | this PR | |---|---|---| | `camel_runtime_routes {"name":"nosuch"}` | routes of `orders` | error: no Camel process matches `nosuch` | | `camel_runtime_routes {"name":"orders"}` | routes of `orders` (by luck) | routes of `orders`, note "nameOrPid is the argument name (got name)" | | `camel_runtime_routes {"process":"nosuch"}` | routes of `orders` | error: process is not an argument ..., give the name or pid as nameOrPid | - camel-jbang-mcp: all 547 tests pass, built in a reactor with this core. - camel-jbang-core: all pass, except two groups on this machine: - 9 tests of `ExportTest` and `RunExportGoldenTest` failed with "Address already in use" on 8080, because another `camel run` on the machine held that port at the time. - `DependencyUpdateTest` failed once and passes on its own. The suites of the two earlier PRs passed all of these, and CI runs them on a clean machine. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
