{"record":{"id":"1d70d651ce3c093b","repo":"microsoft/semantic-kernel","slug":"no-function-result-provided-in-the-tool-message","errorCode":null,"errorMessage":"No function result provided in the tool message.","messagePattern":"No function result provided in the tool message\\.","errorType":"validation","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Connectors/Connectors.MistralAI/Client/MistralClient.cs","lineNumber":773,"sourceCode":"            {\n                if (item is not FunctionResultContent resultContent)\n                {\n                    continue;\n                }\n\n                messages ??= [];\n\n                var stringResult = ProcessFunctionResult(resultContent.Result ?? string.Empty, toolCallBehavior);\n                var name = $\"{resultContent.PluginName}-{resultContent.FunctionName}\";\n                messages.Add(new MistralChatMessage(chatMessage.Role.ToString(), stringResult)\n                {\n                    Name = name,\n                    ToolCallId = resultContent.CallId\n                });\n            }\n\n            return messages\n                ?? throw new NotSupportedException(\"No function result provided in the tool message.\");\n        }\n\n        if (chatMessage.Items.Count == 1 && chatMessage.Items[0] is TextContent text)\n        {\n            return [new MistralChatMessage(chatMessage.Role.ToString(), text.Text)];\n        }\n\n        List<ContentChunk> content = [];\n        foreach (var item in chatMessage.Items)\n        {\n            if (item is TextContent textContent && !string.IsNullOrEmpty(textContent.Text))\n            {\n                content.Add(new TextChunk(textContent.Text!));\n                continue;\n            }\n\n            if (item is ImageContent imageContent)\n            {","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Connectors/Connectors.MistralAI/Client/MistralClient.cs#L755-L791","documentation":"Thrown as a NotSupportedException when the tool-message conversion logic finishes without populating the messages list. It indicates a chat message with a Tool role was processed but no FunctionResultContent was found inside it to extract a result string. The connector cannot construct a valid Mistral tool-response message without a function result.","triggerScenarios":"A chat message has AuthorRole.Tool but its Items collection contains no FunctionResultContent; or the FunctionResultContent is present but the code path that adds to 'messages' was bypassed (e.g., a malformed/hand-crafted ChatMessageContent).","commonSituations":"Manually constructing tool messages instead of using the auto-invocation pipeline; a serialization round-trip that dropped the FunctionResultContent; a plugin returned a null/empty result content item.","solutions":["Let the auto-invocation pipeline produce tool messages rather than hand-building them.","If constructing manually, ensure each Tool-role message contains exactly one FunctionResultContent with a non-null Result.","Inspect chatMessage.Items before sending; verify at least one FunctionResultContent exists for tool messages."],"exampleFix":"// before\nhistory.AddMessage(AuthorRole.Tool, \"\", metadata: null);\n\n// after\nhistory.Add(new ChatMessageContent(AuthorRole.Tool, \"\")\n{\n    Items = [new FunctionResultContent(\"myPlugin\", \"myFunc\", callId, result)]\n});","handlingStrategy":"validation","validationCode":"foreach (var msg in chatHistory)\n{\n    if (msg.Role == AuthorRole.Tool &&\n        !msg.Items.OfType<FunctionResultContent>().Any())\n    {\n        throw new InvalidOperationException(\"Tool message lacks a FunctionResultContent.\");\n    }\n}","typeGuard":"static bool ToolMessagesHaveResults(ChatHistory history) =>\n    history.All(m => m.Role != AuthorRole.Tool ||\n        m.Items.OfType<FunctionResultContent>().Any());","tryCatchPattern":null,"preventionTips":["Prefer the auto-invocation pipeline over manual tool-message construction.","Validate that tool-role messages contain FunctionResultContent before sending.","Avoid serialization round-trips that may drop content items."],"tags":["mistralai","tool-calling","function-result","not-supported"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}