feat: add debug tool command to call tools directly - #4492
Merged
Merged
Conversation
Lets you invoke an agent's tool from the CLI with a JSON parameters object, bypassing the LLM turn. Supports deferred tools without activation and agent selection via --agent. Assisted-By: cagent
callDebugTool now checks ctx.Err() before and after invoking a handler so a canceled/expired debug call can't still fire a tool or report success. Background jobs toolset also rejects launches when the host marks the context, since debug tool exits before any backgrounded process could ever be reaped. Assisted-By: docker-agent
trungutt
approved these changes
Oct 1, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 1, 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.
Debugging a tool often means wiring up a full agent config just to see
what one specific tool returns for a given set of parameters. This adds
a
debug toolcommand that calls a tool directly, outside of any LLMloop, so misbehaving tools can be reproduced and inspected quickly.
docker agent debug tool <config> <tool> [JSON params]loads the normaltoolsets from the given config, lists and invokes deferred tools as
needed, and runs the named tool with the given JSON parameters
(defaulting to
{}when omitted).-a/--agentselects which agent'stoolset to use, and
--jsonswitches from a trimmed, readable summaryto the full raw result. The command surfaces warnings and result errors
and makes sure resources are cleaned up afterwards.
The follow-up commit hardens this against two gaps found during review:
the command now stops acting once its context is canceled instead of
pressing on with a dead client, and it rejects attempts to launch
built-in background jobs (including from code-mode and deferred tools)
since those are long-running and don't make sense in a one-shot debug
invocation. Both commits are covered by tests, including MCP structured
and media content round-trips, tool filtering, canceled filesystem
writes, and the various recall code paths; docs were updated to
describe the new command.