Tutorials
toModelOutput is not called when your tool throws, and the raw error goes to the provider
On ai 7.0.114, whatever your tool execute function throws is serialised and sent to the model provider in a tool_result block marked is_error. The documented toModelOutput hook is skipped on that path. Measured first-party with a local capture server, no API key.
9 min read8