[DOCS] canUseTool callback documentation states two arguments but both SDKs use three

Resolved 💬 3 comments Opened Jan 24, 2026 by coygeek Closed Feb 27, 2026

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://platform.claude.com/docs/en/agent-sdk/user-input

Section/Topic

"Handle tool approval requests" section

Current Documentation

The prose states:

Once you've passed a canUseTool callback in your query options, it fires when Claude wants to use a tool that isn't auto-approved. Your callback receives two arguments:

Followed by a table listing only toolName and input.

However, the Python code example immediately below shows:

async def can_use_tool(
    tool_name: str, input_data: dict, context: ToolPermissionContext
) -> PermissionResultAllow | PermissionResultDeny:

And the TypeScript SDK Reference defines CanUseTool as:

type CanUseTool = (
  toolName: string,
  input: ToolInput,
  options: {
    signal: AbortSignal;
  }
) => ...

What's Wrong or Missing?

The prose explicitly states the callback receives two arguments, but:

  • The Python code examples throughout the page show three arguments (including context: ToolPermissionContext)
  • The TypeScript SDK Reference confirms three arguments (including options with AbortSignal)

Users following the text description may write callbacks with only two parameters, resulting in:

  • TypeError in Python (missing positional argument context)
  • TypeScript users missing access to the AbortSignal for cancellation handling

Suggested Improvement

Update the text and table to document all three arguments:

Your callback receives three arguments:

| Argument | Description |
|----------|-------------|
| toolName | The name of the tool Claude wants to use (e.g., "Bash", "Write", "Edit") |
| input | The parameters Claude is passing to the tool. Contents vary by tool. |
| context/options | Context object containing metadata. In Python: ToolPermissionContext. In TypeScript: { signal: AbortSignal } for cancellation handling. |

Impact

High - Prevents users from using a feature

Additional Context

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗