Skip to content

docs: improve tool execution error documentation#14000

Open
nielskaspers wants to merge 1 commit intovercel:mainfrom
nielskaspers:docs/issue-13798-tool-execution-error
Open

docs: improve tool execution error documentation#14000
nielskaspers wants to merge 1 commit intovercel:mainfrom
nielskaspers:docs/issue-13798-tool-execution-error

Conversation

@nielskaspers
Copy link
Copy Markdown
Contributor

Summary

  • Expand the "Handling Errors" section in the tools and tool calling guide with a detailed explanation of how tool execution errors work: when a tool's execute function throws, the SDK catches the error and represents it as a tool-error content part instead of re-throwing
  • Document tool-error content part properties (type, toolCallId, toolName, input, error)
  • Add clear generateText and streamText examples showing how to inspect tool-error parts
  • Add guidance on monitoring tool errors via experimental_onToolCallFinish event listener
  • Add a new "Handling tool execution errors" section to the core error handling page with a cross-link to the tool calling docs

Issue

Fixes #13798

Testing

  • Review the rendered documentation for accuracy and completeness
  • All code examples match the current AI SDK v6 API surface (no references to the removed ToolExecutionError class)

Expand documentation for how tool execution errors are handled in the
AI SDK. When a tool's execute function throws, the error is caught and
represented as a tool-error content part rather than being re-thrown.
This enables multi-step tool use where the model can see and recover
from failures.

Changes:
- Expand "Handling Errors" section in tools-and-tool-calling with
  detailed explanation of tool-error content parts and their properties
- Add separate generateText and streamText examples showing how to
  inspect tool-error parts
- Add section on monitoring tool errors via onToolCallFinish listener
- Add "Handling tool execution errors" section to core error-handling
  page with cross-link to tool calling docs

Fixes vercel#13798
@tigent tigent bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. documentation Improvements or additions to documentation labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool execution error docs

1 participant