From 69d565e55d9cc774dac599fe036dde87c9b30e82 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sat, 11 Oct 2025 16:58:11 +0200 Subject: [PATCH] fix(mcp): make responses compliant to OpenAI APIs (#6436) The result is enclosed in the Message field. Signed-off-by: Ettore Di Giacinto --- core/http/endpoints/openai/mcp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/http/endpoints/openai/mcp.go b/core/http/endpoints/openai/mcp.go index ed0d0f843..ef802d5f1 100644 --- a/core/http/endpoints/openai/mcp.go +++ b/core/http/endpoints/openai/mcp.go @@ -122,7 +122,7 @@ func MCPCompletionEndpoint(cl *config.ModelConfigLoader, ml *model.ModelLoader, ID: id, Created: created, Model: input.Model, // we have to return what the user sent here, due to OpenAI spec. - Choices: []schema.Choice{{Text: f.LastMessage().Content}}, + Choices: []schema.Choice{{Message: &schema.Message{Role: "assistant", Content: &f.LastMessage().Content}}}, Object: "text_completion", }