Skip to content

feat(cli): /debug-tool-call to inspect the last tool call#205

Merged
emal-avala merged 1 commit intomainfrom
feat/debug-tool-call
Apr 23, 2026
Merged

feat(cli): /debug-tool-call to inspect the last tool call#205
emal-avala merged 1 commit intomainfrom
feat/debug-tool-call

Conversation

@emal-avala
Copy link
Copy Markdown
Member

Summary

  • Adds /debug-tool-call (aliases /dtc, /last-tool) — inspect the most recent tool invocation in the session.
  • Pairs each tool_use block with its matching tool_result, rendering name, id, JSON input, and result (with error flag).
  • Supports /debug-tool-call <N> for Nth-most-recent, /debug-tool-call list for the last 10, and /debug-tool-call full to disable output truncation.

Why

When a tool call misbehaves — wrong args, surprising result — the user currently has no quick way to see exactly what the model sent and what came back. This command reads straight from the session's message log, so it works for the current session and any resumed session.

Test plan

  • cargo clippy -p agent-code --all-targets -- -D warnings
  • cargo clippy -p agent-code-lib --all-targets -- -D warnings
  • cargo test -p agent-code --bin agent (92 passed)
  • New unit tests:
    • collect_tool_calls_pairs_use_with_result
    • collect_tool_calls_empty_session_returns_empty
    • collect_tool_calls_marks_error_flag
    • clip_for_display_shortens_long_text
    • clip_for_display_passes_short_text_through

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@emal-avala emal-avala force-pushed the feat/debug-tool-call branch from 057c1ee to 71e7c76 Compare April 23, 2026 08:11
Walks the conversation history, pairs tool_use blocks with their
matching tool_result, and prints the most recent call's tool name,
id, input, and result. Useful for debugging when the agent
misbehaves and you want to see exactly what it invoked.

Usage:
  /debug-tool-call         inspect the most recent call
  /debug-tool-call 2       inspect the 2nd-most-recent call
  /debug-tool-call list    list the last 10 calls
  /debug-tool-call full    show untrimmed input/result

Aliases: /dtc, /last-tool
@emal-avala emal-avala force-pushed the feat/debug-tool-call branch from 71e7c76 to c6327eb Compare April 23, 2026 08:39
@emal-avala emal-avala merged commit 27ab368 into main Apr 23, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/debug-tool-call branch April 23, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant