The Mistral Structured handler (src/Providers/Mistral/Handlers/Structured.php) does not include tools or tool_choice in the API request payload, even though the Structured\Request object carries them. This means agents that implement both structured output and tool calling silently lose all tool functionality when using Mistral.
Mistral's API supports response_format and tools in the same request - they are independent parameters. The Mistral Text handler already includes both tools and tool_choice correctly. The Structured handler just needs the same treatment, plus a tool call loop (like Text has) so it can execute tools and continue until the model returns a final structured response.
Expected behavior: When a Structured\Request has tools, the handler should include them in the API request and handle FinishReason::ToolCalls responses by executing the tools and continuing the loop, matching how the Text handler works.
Actual behavior: Tools are silently dropped. The model never sees them and cannot make tool calls. No error is raised.
For reference, the Anthropic Structured handler already supports tools via its ToolStructuredStrategy and tool call loop.
The Mistral Structured handler (
src/Providers/Mistral/Handlers/Structured.php) does not include tools ortool_choicein the API request payload, even though theStructured\Requestobject carries them. This means agents that implement both structured output and tool calling silently lose all tool functionality when using Mistral.Mistral's API supports
response_formatand tools in the same request - they are independent parameters. The Mistral Text handler already includes both tools andtool_choicecorrectly. The Structured handler just needs the same treatment, plus a tool call loop (like Text has) so it can execute tools and continue until the model returns a final structured response.Expected behavior: When a
Structured\Requesthas tools, the handler should include them in the API request and handleFinishReason::ToolCallsresponses by executing the tools and continuing the loop, matching how the Text handler works.Actual behavior: Tools are silently dropped. The model never sees them and cannot make tool calls. No error is raised.
For reference, the Anthropic Structured handler already supports tools via its ToolStructuredStrategy and tool call loop.