Skip to content

fix(ai): Add await to tool execution#1882

Merged
chris-olszewski merged 2 commits intomainfrom
olszewski/fix_gh_1881
Jan 12, 2026
Merged

fix(ai): Add await to tool execution#1882
chris-olszewski merged 2 commits intomainfrom
olszewski/fix_gh_1881

Conversation

@chris-olszewski
Copy link
Member

What was changed

Add missing await call to executeToolActivity

Why?

close would end up getting called before tool execution would be completed

Checklist

  1. Closes [Bug] AI-SDK - callToolActivity #1881

  2. How was this tested:
    Added failing test in first commit that verifies close is called after the activity completes.

  3. Any docs updates needed?
    N/A

chris-olszewski and others added 2 commits January 12, 2026 10:19
Add a test that verifies the MCP client close() method is called
after tool.execute() completes, not before. This test currently
fails because callToolActivity is missing an await keyword.

Reproduces #1881

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add missing await before tool.execute() call in callToolActivity.
Without this await, the finally block would close the MCP client
connection before the tool execution completed, causing the
connection to be terminated prematurely.

Fixes #1881

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@chris-olszewski chris-olszewski requested a review from a team as a code owner January 12, 2026 15:25
@chris-olszewski chris-olszewski merged commit 330fdec into main Jan 12, 2026
47 of 52 checks passed
@chris-olszewski chris-olszewski deleted the olszewski/fix_gh_1881 branch January 12, 2026 17:18
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.

[Bug] AI-SDK - callToolActivity

3 participants