# How do I check a Claude Agent SDK tool call without touching the prompt?

Register a hook: a callback the SDK invokes at a named point in the loop, most usefully `PreToolUse` before a tool call runs or `PostToolUse` after it returns. The callback receives the tool's name and arguments, or its result for `PostToolUse`, and it runs in your own process, entirely outside the model's context, so nothing about the check has to be phrased as an instruction the model might ignore or forget.

A `matcher` pattern scopes a hook to specific tools, `"Write|Edit"` for file writes or a regex like `^mcp__` for every MCP tool, or you can omit it to run on every call. The callback's return value decides what happens next: an empty object lets the call through unchanged, while a `permissionDecision` of `deny` blocks it and hands the model a reason it can act on, rather than a call that just silently vanished. A `PostToolUse` hook can't stop a call already made, but it can attach `additionalContext` to the result before the model reads it. A hook scoped to `^mcp__` is a natural place to catch [an MCP call failing in a way the model itself never sees](/answers/tool-calling/how-reliable-are-mcp-tool-calls-in-production), before it reaches the rest of the loop.

---

Sources:
- Claude Docs: Hooks in the Agent SDK: https://code.claude.com/docs/en/agent-sdk/hooks (fetched 2026-09-14)

Source: https://tessary.ai/answers/claude-agent-sdk-evals/how-do-i-check-a-tool-call-without-touching-the-prompt
More on Claude agent sdk evals: https://tessary.ai/answers/claude-agent-sdk-evals
From Tessary, agent reliability for AI agents in production: https://tessary.ai
