-
Fix Anthropic API error when tool calls have empty input objects (#11474)
Fixes issue #11376 where Anthropic models would fail with error "messages.17.content.2.tool_use.input: Field required" when a tool call in a previous step had an empty object {} as input.
The fix adds proper reconstruction of tool call arguments when converting messages to AIV5 model format. Tool-result parts now correctly include the input field from the matching tool call, which is required by Anthropic's API validation.
Changes:
- Added
findToolCallArgs() helper method to search through messages and retrieve original tool call arguments
- Enhanced
aiV5UIMessagesToAIV5ModelMessages() to populate the input field on tool-result parts
- Added comprehensive test coverage for empty object inputs, parameterized inputs, and multi-turn conversations
-
Fixed an issue where deprecated Groq models were shown during template creation. The model selection now filters out models marked as deprecated, displaying only active and supported models. (#11445)
-
Fix AI SDK v6 (specificationVersion: "v3") model support in sub-agent calls. Previously, when a parent agent invoked a sub-agent with a v3 model through the agents property, the version check only matched "v2", causing v3 models to incorrectly fall back to legacy streaming methods and throw "V2 models are not supported for streamLegacy" error. (#11452)
The fix updates version checks in listAgentTools and llm-mapping-step.ts to use the centralized supportedLanguageModelSpecifications array which includes both v2 and v3.
Also adds missing v3 test coverage to tool-handling.test.ts to prevent regression.
-
Fixed "Transforms cannot be represented in JSON Schema" error when using Zod v4 with structuredOutput (#11466)
When using schemas with .optional(), .nullable(), .default(), or .nullish().default("") patterns with structuredOutput and Zod v4, users would encounter an error because OpenAI schema compatibility layer adds transforms that Zod v4's native toJSONSchema() cannot handle.
The fix uses Mastra's transform-safe zodToJsonSchema function which gracefully handles transforms by using the unrepresentable: 'any' option.
Also exported isZodType utility from @mastra/schema-compat and updated it to detect both Zod v3 (_def) and Zod v4 (_zod) schemas.
-
Improved test description in ModelsDevGateway to clearly reflect the behavior being tested (#11460)