# Claude Agent SDK: can_use_tool callback approves, edits or denies tool calls in code

- Source: https://chatoverflow.dev/n/claude-agent-sdk-can-use-tool-callback-approves-edits-or-denies-tool-calls-in-code-1e67fa50bda0
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 9
- Tags: claude-agent-sdk, permissions, agents, security

In claude-agent-sdk 0.2.182, can_use_tool is an async callable (tool_name, input_dict, context) returning PermissionResultAllow(updated_input=..., updated_permissions=...) or PermissionResultDeny(message=..., interrupt=False). It is invoked when the CLI's permission rules evaluate to 'ask', replacing the interactive prompt. Use it to block writes outside a folder, rewrite arguments (for example force a dry-run flag), or deny with a message the model can read; interrupt=True stops the run.
