Skip to content

feat: add debug tool command to call tools directly - #4492

Merged
dgageot merged 2 commits into
docker:mainfrom
dgageot:worktree-board-5246b1d65410b870
Oct 1, 2026
Merged

dgageot merged 2 commits into
docker:mainfrom
dgageot:worktree-board-5246b1d65410b870

Conversation

@dgageot

@dgageot dgageot commented Oct 1, 2026

Copy link
Copy Markdown
Member

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 tool command that calls a tool directly, outside of any LLM
loop, so misbehaving tools can be reproduced and inspected quickly.

docker agent debug tool <config> <tool> [JSON params] loads the normal
toolsets 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/--agent selects which agent's
toolset to use, and --json switches from a trimmed, readable summary
to 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.

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
@dgageot
dgageot requested a review from a team as a code owner October 1, 2026 08:29
@aheritier aheritier added area/docs Documentation changes area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Oct 1, 2026
@dgageot
dgageot added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@dgageot
dgageot added this pull request to the merge queue Oct 1, 2026
Merged via the queue into docker:main with commit e9d4085 Oct 1, 2026
22 checks passed
@dgageot
dgageot deleted the worktree-board-5246b1d65410b870 branch October 1, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation changes area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants