Skip to content

fix: Call after_call callback when tool doesn't exist#1373

Open
BillionClaw wants to merge 1 commit intosimonw:mainfrom
BillionClaw:clawoss/fix-tool-debug-output-chat
Open

fix: Call after_call callback when tool doesn't exist#1373
BillionClaw wants to merge 1 commit intosimonw:mainfrom
BillionClaw:clawoss/fix-tool-debug-output-chat

Conversation

@BillionClaw
Copy link

Fixes #1151

The --td (tool debug) flag was not showing debug output when a model tried to call a tool that doesn't exist. This happened because the after_call callback was not being invoked when:

  1. The tool doesn't exist (tool is None)
  2. The tool has no implementation

Changes:

  • Response.execute_tool_calls(): Call after_call when tool is None
  • AsyncResponse.execute_tool_calls(): Call after_call when tool is None or has no implementation in both sync and async branches

This ensures that users always see debug output when using --td, even when the model calls a tool incorrectly (e.g., using the wrong tool name).

The --td (tool debug) flag was not showing debug output when a model
tried to call a tool that doesn't exist. This happened because the
after_call callback was not being invoked in the error case.

Changes:
- Response.execute_tool_calls(): Call after_call when tool is None
- AsyncResponse.execute_tool_calls(): Call after_call when tool is None
  or has no implementation in both sync and async branches

Fixes simonw#1151
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.

No tool debug output from llm chat -T QuickJS -m qwen3:4b --td

1 participant