Skip to content

feat(ui, react): add resetToolApproval method to useChat#12254

Open
WeiAnAn wants to merge 3 commits intovercel:mainfrom
WeiAnAn:feat/reset-tool-approval
Open

feat(ui, react): add resetToolApproval method to useChat#12254
WeiAnAn wants to merge 3 commits intovercel:mainfrom
WeiAnAn:feat/reset-tool-approval

Conversation

@WeiAnAn
Copy link

@WeiAnAn WeiAnAn commented Feb 4, 2026

Background

When using tool approval workflows, users may want to reset a tool approval response back to the requested state. This allows users to change their mind after responding to a tool approval request, without needing to reload the entire chat.

Summary

Added a new resetToolApproval method to the useChat hook that:

  • Accepts an id parameter (the approval ID)
  • Resets a tool part's state from approval-responded back to approval-requested
  • Removes the approved and reason fields from the approval object

Manual Verification

Run UI test in next-openai example at http://localhost:3000/test-tool-approval
output

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

WeiAnAn and others added 3 commits February 4, 2026 23:50
Add a new method `resetToolApproval` to the `useChat` hook that resets
a tool part's state from `approval-responded` back to `approval-requested`.

This allows users to reset a tool approval response and request approval again.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add resetToolApproval to useChat reference docs
- Export ChatResetToolApprovalFunction type from ai package
- Add Reset button to tool approval example in next-openai

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel-ai-sdk vercel-ai-sdk bot added the ai/ui label Feb 4, 2026
@WeiAnAn WeiAnAn changed the title feat(ui): add resetToolApproval method to useChat feat(ui, react): add resetToolApproval method to useChat Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant