-
Notifications
You must be signed in to change notification settings - Fork 386
Description
🐞 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
- Add an MCP server with an Output Schema defined in the gateway.
- Add the tools of this mcp server in a virtual server.
- 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 - 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
🧠 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 |