Prompt message content returned as raw JSON instead of typed content
## Problem Prompt messages are returned to the client as a single block of raw, pretty-printed JSON instead of proper content. For a configured prompt, an MCP client (e.g. VS Code + GitHub Copilot) renders each message's content as a literal JSON array, e.g.: ``` --USER [ { "type": "text", "text": "Create a match strategy ..." } ] ``` The root cause is a shape mismatch between how this module stores message content and what the SDK formatter expects. `McpPromptConfig` stores each message as `{role, content: [ {type:'text', text:'...'} ]}` — i.e. `content` is a **list** of typed content items (`src/Entity/McpPromptConfig.php`). `PromptConfigHandler::get()` returns this verbatim. The SDK's `PromptResultFormatter::formatContent()` (`vendor/mcp/sdk/src/Capability/Formatter/PromptResultFormatter.php:145`) expects `content` to be a **single** content item — a string, a `Content` object, or one typed array like `{type:'text', ...}`. When handed a list, none of its branches match (`isset($content['type'])` is false because the array is a list with no top-level `type` key), so it falls through to the final branch and does `json_encode($content, JSON_PRETTY_PRINT | ...)`, wrapping the whole array into one `TextContent`. `JSON_PRETTY_PRINT` produces exactly the 4-space-indented array dump observed. ## Expected behavior Each message's content should be returned as proper MCP content so the client renders the text (or image/audio/resource) directly, not as a JSON dump. Since MCP's `PromptMessage` carries exactly one content block, the module must reconcile its multi-item content model with the SDK: either expand each stored content item into its own `PromptMessage` with the same role before returning, or return content in a shape the SDK formatter accepts (single item per message, or SDK `Content` objects). ## Steps to reproduce 1. Configure an `McpPromptConfig` with at least one message whose `content` holds one or more typed items (e.g. a single `text` item). 2. Connect an MCP client (e.g. VS Code + GitHub Copilot) and invoke the prompt. 3. Observe that the message content is rendered as a literal, pretty-printed JSON array rather than as text. ## Additional context - Module storage model: `src/Entity/McpPromptConfig.php` (`messages` as `array<int, array{role: string, content: array}>`). - Handler returning raw templates: `src/Capability/Handler/PromptConfigHandler.php`. - SDK formatter fallback that produces the JSON dump: `vendor/mcp/sdk/src/Capability/Formatter/PromptResultFormatter.php:145` (the trailing `json_encode(... JSON_PRETTY_PRINT ...)` branch). This is related to the missing argument substitution reported separately; both surface when serving configured prompts and both should be fixed in the prompt handler path. This module is pre-release; no backwards-compatibility layer is required.
issue