Skip to content

Fix:Missing Structured Content for Virtual Server in Streamable HTTP Response#1412

Merged
crivetimihai merged 13 commits intomainfrom
outpout_schema_steamablehttp
Nov 12, 2025
Merged

Fix:Missing Structured Content for Virtual Server in Streamable HTTP Response#1412
crivetimihai merged 13 commits intomainfrom
outpout_schema_steamablehttp

Conversation

@rakdutta
Copy link
Copy Markdown
Collaborator

@rakdutta rakdutta commented Nov 10, 2025

closing issue #1406
This pull request introduces improvements to the handling and processing of tool responses, particularly for structured content, and enhances logging for debugging and traceability. The changes ensure that both unstructured and structured outputs from tools are correctly normalized and returned, and that the code is robust against different field naming conventions and model types.
Tool response handling and normalization:

  • Updated call_tool in streamablehttp_transport.py to return both unstructured and structured content when available, supporting both snake_case and camelCase field names for structured content. This allows downstream validation against output schemas.
  • In tool_service.py, enhanced extraction of structured content from tool responses by accepting both structuredContent and structured_content fields, improving compatibility with different model serialization formats.

Unit test robustness:

  • Updated unit tests in test_streamablehttp_transport.py to explicitly unset structured_content and override model_dump on mocks, preventing accidental attribute leakage and ensuring test accuracy.

@rakdutta rakdutta marked this pull request as ready for review November 10, 2025 15:49
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Copy link
Copy Markdown
Member

@kevalmahajan kevalmahajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Structured Content is properly generated now with both /mcp as well as /sse and is being validated with the defined OutputSchema for the tool on the mcp client side.

- Change verbose info logging to debug level for tool responses
  to reduce production log noise while maintaining debug capability
- Remove redundant isinstance check in plugin response handling
- Add comprehensive docstring explaining structured content return
  types and MCP SDK behavior in call_tool function
- Add test case for structured content validation with tuple returns
- Improve code maintainability and documentation clarity

These changes enhance code quality without altering functionality,
improving pylint score from 9.64 to 9.77.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai force-pushed the outpout_schema_steamablehttp branch from d8c0937 to e6deb8e Compare November 12, 2025 08:40
@crivetimihai crivetimihai merged commit 491c8ba into main Nov 12, 2025
45 checks passed
@crivetimihai crivetimihai deleted the outpout_schema_steamablehttp branch November 12, 2025 09:34
Nayana-R-Gowda pushed a commit that referenced this pull request Nov 14, 2025
…Response (#1412)

* streamblehttp output_schema

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* primitive_types

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* primitive

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* mcp-structure

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* output_schema

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* flake

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* test

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* ruff

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* remove logging

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* invoke_hook

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* plugging response

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* plugging

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* refactor: improve structured content handling and code quality

- Change verbose info logging to debug level for tool responses
  to reduce production log noise while maintaining debug capability
- Remove redundant isinstance check in plugin response handling
- Add comprehensive docstring explaining structured content return
  types and MCP SDK behavior in call_tool function
- Add test case for structured content validation with tuple returns
- Improve code maintainability and documentation clarity

These changes enhance code quality without altering functionality,
improving pylint score from 9.64 to 9.77.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
kcostell06 pushed a commit to kcostell06/mcp-context-forge that referenced this pull request Feb 24, 2026
…Response (IBM#1412)

* streamblehttp output_schema

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* primitive_types

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* primitive

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* mcp-structure

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* output_schema

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* flake

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* test

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* ruff

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* remove logging

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* invoke_hook

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* plugging response

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* plugging

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>

* refactor: improve structured content handling and code quality

- Change verbose info logging to debug level for tool responses
  to reduce production log noise while maintaining debug capability
- Remove redundant isinstance check in plugin response handling
- Add comprehensive docstring explaining structured content return
  types and MCP SDK behavior in call_tool function
- Add test case for structured content validation with tuple returns
- Improve code maintainability and documentation clarity

These changes enhance code quality without altering functionality,
improving pylint score from 9.64 to 9.77.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants