Skip to content

Comments

feat: add PostToolUseFailure hook event type#535

Merged
ashwin-ant merged 1 commit intomainfrom
ashwin/add-post-tool-use-failure-hook
Jan 30, 2026
Merged

feat: add PostToolUseFailure hook event type#535
ashwin-ant merged 1 commit intomainfrom
ashwin/add-post-tool-use-failure-hook

Conversation

@ashwin-ant
Copy link
Collaborator

@ashwin-ant ashwin-ant commented Jan 30, 2026

Summary

  • Add PostToolUseFailureHookInput type with fields for tool_name, tool_input, tool_use_id, error, and optional is_interrupt
  • Add PostToolUseFailureHookSpecificOutput type with additionalContext field
  • Add "PostToolUseFailure" to HookEvent, HookInput, and HookSpecificOutput union types
  • Export new types from __init__.py and add to __all__

Test plan

  • Verify PostToolUseFailureHookInput can be constructed with required and optional fields
  • Verify PostToolUseFailureHookSpecificOutput accepts valid output shapes
  • Verify type checking passes with mypy
  • Verify existing tests still pass

Changelog

Added PostToolUseFailure hook event type for handling tool use failures, including PostToolUseFailureHookInput and PostToolUseFailureHookSpecificOutput types.

Add support for the PostToolUseFailure hook event, which fires when a
tool use fails. This includes:

- PostToolUseFailureHookInput with tool_name, tool_input, tool_use_id,
  error, and optional is_interrupt fields
- PostToolUseFailureHookSpecificOutput with additionalContext field
- "PostToolUseFailure" literal added to HookEvent, HookInput, and
  HookSpecificOutput union types
- New types exported from __init__.py and added to __all__

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ashwin-ant ashwin-ant requested a review from a team January 30, 2026 05:02
@ashwin-ant ashwin-ant merged commit abf5fae into main Jan 30, 2026
18 of 28 checks passed
@ashwin-ant ashwin-ant deleted the ashwin/add-post-tool-use-failure-hook branch January 30, 2026 05:11
phil65 pushed a commit to phil65/claude-agent-sdk-python that referenced this pull request Jan 30, 2026
## Summary
- Add `PostToolUseFailureHookInput` type with fields for `tool_name`,
`tool_input`, `tool_use_id`, `error`, and optional `is_interrupt`
- Add `PostToolUseFailureHookSpecificOutput` type with
`additionalContext` field
- Add `"PostToolUseFailure"` to `HookEvent`, `HookInput`, and
`HookSpecificOutput` union types
- Export new types from `__init__.py` and add to `__all__`

## Test plan
- [ ] Verify `PostToolUseFailureHookInput` can be constructed with
required and optional fields
- [ ] Verify `PostToolUseFailureHookSpecificOutput` accepts valid output
shapes
- [ ] Verify type checking passes with `mypy`
- [ ] Verify existing tests still pass

## Changelog
<!-- CHANGELOG:START -->
Added `PostToolUseFailure` hook event type for handling tool use
failures, including `PostToolUseFailureHookInput` and
`PostToolUseFailureHookSpecificOutput` types.
<!-- CHANGELOG:END -->

🤖 Generated with [Claude Code](https://claude.com/claude-code) (0%
4-shotted by claude)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants