# How should I normalize tool results in a Claude Agent SDK workflow?

Exam: CCAR-F — Claude Certified Architect - Foundations (CCAR-F)
Knowledge domain: Tool Design & MCP Integration
Updated: 2026-12-04T01:16:40.351712+00:00
HTML: https://learningpathx.com/faq/CCAR-F/ccarf-normalize-tool-results.html

## Also asked as

- How can an Agent SDK result adapter preserve timestamp units, status meanings, and errors?
- What should I retain when converting different tools' outputs into a common format?

Normalize from each tool's documented contract, and retain the raw result, tool identity, and any conversion failure. A common representation is useful only when it preserves the meaning of the original data.

For timestamps, establish whether a numeric value means Unix seconds or milliseconds. Require a timezone or offset for text that must identify an instant. Convert an established instant to the chosen representation, such as UTC; leave an ambiguous local time unresolved. For status codes, use a mapping specific to the source tool. An unfamiliar code remains unknown rather than becoming success.

Keep execution and normalization outcomes separate. A tool may execute successfully but return a timestamp that cannot be interpreted. A timeout is an execution failure, not an empty successful result. A useful application-owned record includes the source tool, raw value, declared format, normalized value, and conversion status.

Place pre-action enforcement before dispatch. Use post-result processing for data the tool has already returned. In the current Agent SDK hook contract, `PostToolUse` can append `additionalContext` or replace output with `updatedToolOutput` for built-in and MCP tools; the older `updatedMCPToolOutput` applies only to MCP output. Match the fields to your installed SDK. An executor wrapper can also normalize its own return value.

Test a valid conversion, missing or malformed time, absent timezone, unknown status, and execution failure. Inspect what the consumer actually receives and preserve the failure if delivery or conversion fails. Post-processing cannot undo an external action.

[Agent SDK hooks](https://code.claude.com/docs/en/agent-sdk/hooks)

Source: [Apply Agent SDK hooks for tool call interception and data normalization](https://learningpathx.com/material/CCAR-F/apply-agent-sdk-hooks-for-tool-call-interception-and-data-normalization.html)
