Skip to content

[Bug]: Missing Structured Content for Virtual Server in Streamable HTTP Response #1406

@kevalmahajan

Description

@kevalmahajan

🐞 Bug Summary

When using streamable HTTP as the transport to connect to the virtual server, the response from the tool call does not include structured content even if output schema is defined for that tool. However, when using SSE transport, the structured content is correctly returned and validated without any issues. The problem is specific to the streamable HTTP transport.


🧩 Affected Component

Select the area of the project impacted:

  • mcpgateway - API
  • mcpgateway - UI (admin panel)
  • mcpgateway.wrapper - stdio wrapper
  • Federation or Transports
  • CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)
  • Other (explain below)

🔁 Steps to Reproduce

  1. Add an MCP server with an Output Schema defined in the gateway.
  2. Add the tools of this mcp server in a virtual server.
  3. Connect to this mcp server with mcp inspector and see the error : ✗ Validation Error: Tool has an output schema but did not return structured content
  4. Check the tool response as well, structured content key is missing in the tool response as per the new mcp spec.

🤔 Expected Behavior

The tool response content should have a structured content key so that this structured content is validated against the output schema defined by the mcp client


🧩 Suggested Fix:

File needs to be updated: /mcpgateway/transports/streamablehttp_transport.py
The call_tool function currently returns only:

return [types.TextContent(type=content.type, text=content.text) for content in result.content]

Here, the structured content needs to be generated and returned as well.

📓 Logs / Error Output

Image

🧠 Environment Info

You can retrieve most of this from the /version endpoint.

Key Value
Version or commit e.g. v0.9.0 or main@a1b2c3d
Runtime e.g. Python 3.11, Gunicorn
Platform / OS e.g. Ubuntu 22.04, macOS
Container e.g. Docker, Podman, none

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageIssues / Features awaiting triage

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions