Learn · Agentic architecture & orchestration · CCAR-F task 1.5

Hooks for tool calls

Hooks run your code before and after every tool call: block what's forbidden, normalise what comes back, before Claude reasons.

Key ideas

Worked example: Three formats, one hook

orders returns created as 1768435200 and status 2, shipping returns an ISO string and "SHIPPED", billing returns "15/01/2026" and "shipped". One PostToolUse hook on mcp__shop__.* maps all of them to 2026-01-15 and "shipped" before Claude sees any result. Check which input field carries the tool's result in your SDK version's reference.

Exam traps

Official docs

Practise CCAR-F questions · Next lesson: Task decomposition