claude-agent-sdk-python icon indicating copy to clipboard operation
claude-agent-sdk-python copied to clipboard

Expose `tool_use_id` in `can_use_tool` callback

Open nishikantparmariam1 opened this issue 3 weeks ago • 0 comments

In my case, I’ve implemented the can_use_tool callback. When it is invoked multiple times in parallel such as when two sub-agents request permission at the same time - both calls may reference the same tool name. In that situation, there’s no way to identify which sub‑agent triggered a given can_use_tool call. If I could access the tool_use_id for each call, I could read the corresponding ToolUse message and determine its parent_tool_use_id, which would let me map each request back to its originating sub‑agent.

nishikantparmariam1 avatar Nov 28 '25 20:11 nishikantparmariam1