[DOCS] Hook input references omit `duration_ms` for `PostToolUse` and `PostToolUseFailure`
Documentation Type
Incorrect/outdated documentation
Documentation Location
https://code.claude.com/docs/en/agent-sdk/typescript
Section/Topic
PostToolUseHookInput and PostToolUseFailureHookInput in the Agent SDK hook input reference, plus the corresponding hook input documentation for PostToolUse / PostToolUseFailure
Current Documentation
The docs currently show these TypeScript hook input definitions:
####PostToolUseHookInputtype PostToolUseHookInput = BaseHookInput & {hook_event_name: "PostToolUse";tool_name: string;tool_input: unknown;tool_response: unknown;tool_use_id: string;};####PostToolUseFailureHookInputtype PostToolUseFailureHookInput = BaseHookInput & {hook_event_name: "PostToolUseFailure";tool_name: string;tool_input: unknown;tool_use_id: string;error: string;is_interrupt?: boolean;};
The Python reference shows the same omission:
PostToolUseHookInputdocumentstool_name,tool_input,tool_response,tool_use_id,agent_id, andagent_type.PostToolUseFailureHookInputdocumentstool_name,tool_input,tool_use_id,error,is_interrupt,agent_id, andagent_type.
The hooks reference also currently says:
PostToolUsehooks fire after a tool has already executed successfully. The input includes bothtool_input, the arguments sent to the tool, andtool_response, the result it returned.PostToolUseFailurehooks receive the sametool_nameandtool_inputfields as PostToolUse, along with error information as top-level fields.
What's Wrong or Missing?
Changelog v2.1.119 says PostToolUse and PostToolUseFailure hook inputs now include duration_ms (tool execution time, excluding permission prompts and PreToolUse hooks), but the current hook input documentation still omits that field.
As a result, hook authors reading the TypeScript/Python SDK references or the hooks reference cannot discover that duration_ms is available, what it means, or that they can safely consume it in logging, metrics, and automation hooks.
Suggested Improvement
Update the hook input documentation to add duration_ms everywhere PostToolUseHookInput and PostToolUseFailureHookInput are defined or summarized.
Suggested minimum fix:
- Add
duration_msto the TypeScriptPostToolUseHookInputandPostToolUseFailureHookInputtype definitions. - Add
duration_msto the Python class definitions and field tables for those same hook inputs. - Update the hooks reference
PostToolUse input/PostToolUseFailure inputsections to mention the field and define it as tool execution time in milliseconds, excluding permission prompts andPreToolUsehooks. - Update the example JSON payloads to include
duration_msso the new field is discoverable in the main hooks documentation.
Impact
Medium - Makes feature difficult to understand
Additional Context
Affected Pages:
| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/agent-sdk/typescript | 1012-1034 | PostToolUseHookInput / PostToolUseFailureHookInput type definitions omit duration_ms |
| https://code.claude.com/docs/en/agent-sdk/python | 1877-1927 | Python class definitions and field tables omit duration_ms |
| https://code.claude.com/docs/en/hooks | 1145-1222 | PostToolUse / PostToolUseFailure input docs describe fields but do not mention duration_ms |
| https://platform.claude.com/docs/en/agent-sdk/typescript | 1002-1024 | Agent SDK cross-reference has the same omission |
| https://platform.claude.com/docs/en/agent-sdk/python | 1854-1903 | Agent SDK cross-reference has the same omission |
Total scope: 5 pages affected
Source: Changelog v2.1.119
Changelog entry under review: Hooks: PostToolUse and PostToolUseFailure hook inputs now include duration_ms (tool execution time, excluding permission prompts and PreToolUse hooks)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗