Skip to content

fix: preserve MCP tool metadata across transport#1210

Open
Q00 wants to merge 1 commit into
mainfrom
fix/mcp-interview-meta-transport
Open

fix: preserve MCP tool metadata across transport#1210
Q00 wants to merge 1 commit into
mainfrom
fix/mcp-interview-meta-transport

Conversation

@Q00
Copy link
Copy Markdown
Owner

@Q00 Q00 commented May 24, 2026

Summary

  • return MCP SDK CallToolResult from FastMCP wrappers so MCPToolResult.meta survives the served boundary
  • restore SDK result meta in MCPClientAdapter parsing
  • cover server and client metadata preservation for interview reasoning surfaces

Original PR blocker coverage

Addresses the MCP interview reasoning transport blocker reported on #1140.

Verification

  • uv run --extra mcp pytest tests/unit/mcp/server/test_adapter.py tests/unit/mcp/client/test_adapter.py tests/unit/mcp/tools/test_interview_response_diagnostics.py -q
  • uv run ruff check src/ouroboros/mcp/server/adapter.py src/ouroboros/mcp/client/adapter.py tests/unit/mcp/server/test_adapter.py tests/unit/mcp/client/test_adapter.py

Copy link
Copy Markdown
Contributor

@ouroboros-agent ouroboros-agent Bot left a comment

Choose a reason for hiding this comment

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

Review — ouroboros-agent[bot]

Verdict: APPROVE

Metadata

| Field | Value |
|### Recovery Notes
First recoverable review artifact generated from codex analysis log.

---|---|
| PR | #1210 |
| HEAD checked | 261fd0219a91ecf3beb431df56dacdfa59284922 |
| Request ID | req_retry_exhausted_new_timeout_1779693693_1210 |
| Review record | d917bb7a-38f2-4bd7-8a78-824a27134e77 |

What Improved

  • Preserves MCP tool-result metadata across both the FastMCP server boundary and the MCP client adapter parse path.
  • Adds focused unit coverage for metadata preservation on server and client adapters.

Issue Requirements

Requirement Status
No linked issue requirement captured N/A

Prior Findings Status

No prior human or inline review concerns were present in the supplied PR comment artifacts.

Blockers

No in-scope blocking findings remained after policy filtering.

Follow-up Findings

# File:Line Priority Confidence Suggestion
1 src/ouroboros/mcp/tools/subagent.py:198 Low Medium Existing comments still describe FastMCP metadata as dropped. They are now stale after this PR and should be updated in a follow-up to avoid misleading future changes.

Non-blocking Suggestions

| 1 | src/ouroboros/mcp/tools/evaluation_handlers.py:1469 | Documentation | Existing inline documentation says adapter metadata is dropped; this should be refreshed now that _to_fastmcp_tool_result() forwards _meta. |

Test Coverage Notes

  • Reviewed added unit tests in tests/unit/mcp/client/test_adapter.py and tests/unit/mcp/server/test_adapter.py.
  • Could not run pytest because this environment has no pytest module installed.
  • Ran python3 -m py_compile on the changed source and test files successfully.

Design Notes

The change is well-scoped to MCP adapter translation boundaries. It keeps handlers thin and preserves internal MCPToolResult.meta without moving business logic into the server wrapper.

Design / Roadmap Gate

Affected boundary is MCP tool-result serialization/deserialization. Server-side MCPToolResult.meta is now mapped to SDK CallToolResult._meta, and client-side SDK meta is restored into internal MCPToolResult.meta. No persistence, replay, auth, or state-contract regressions were found in the changed paths.

Directional Notes

Maintainer memory emphasized keeping MCP handlers as thin unwrap/delegate/wrap layers; this PR follows that shape. I also checked the locked MCP SDK contract: direct CallToolResult returns with _meta are supported by FastMCP.

Test Coverage

  • Reviewed added unit tests in tests/unit/mcp/client/test_adapter.py and tests/unit/mcp/server/test_adapter.py.
  • Could not run pytest because this environment has no pytest module installed.
  • Ran python3 -m py_compile on the changed source and test files successfully.

Merge Recommendation

Approve. No blocking runtime, API contract, or test-coverage issues were found in the current HEAD snapshot.

Review-Metadata:
verdict: APPROVE
head_sha: 261fd02
request_id: req_retry_exhausted_new_timeout_1779693693_1210
review_profile: memory-aware-zero-trust-v2
advisory_memory_only: true


Reviewed by ouroboros-agent[bot] via Codex deep analysis

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.

1 participant