Skip to content

Write true integration test for MCP stdio wire output validation#3621

Merged
Aniruddh25 merged 2 commits into
copilot/fix-mcp-null-annotationsfrom
copilot/add-integration-test-scenario
May 20, 2026
Merged

Write true integration test for MCP stdio wire output validation#3621
Aniruddh25 merged 2 commits into
copilot/fix-mcp-null-annotationsfrom
copilot/add-integration-test-scenario

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 20, 2026

Why make this change?

Addresses review comment from PR #3616: The existing test serialized content blocks with locally-defined JsonSerializerOptions, so it would pass even if McpStdioServer.WriteResult emitted "annotations": null and "_meta": null in the actual wire output. Not a true regression test.

What is this change?

Rewrote McpStdioServerContentBlockTests to capture actual stdio JSON-RPC wire output:

  • Wire output capture: Inject McpStdoutWriter backed by StringWriter into McpStdioServer
  • Full path execution: Invoke WriteResult via reflection with simulated CallToolResult containing TextContentBlock
  • Protocol-level validation: Parse captured JSON-RPC response and assert annotations and _meta are omitted (not present as null keys)

Test correctly fails when WhenWritingNull serialization policy is removed from WriteResult, confirming regression detection.

How was this tested?

  • Integration Tests
  • Unit Tests

Sample Request(s)

N/A - Test-only change

- Rewrote McpStdioServerContentBlockTests to capture actual stdio wire output
- Test now injects McpStdoutWriter backed by StringWriter into McpStdioServer
- Validates the actual JSON-RPC response emitted by WriteResult
- Verifies annotations and _meta are omitted from wire output, not serialized as null
- Test correctly fails when WhenWritingNull serialization policy is removed
- This is now a true regression test that validates the fix at the wire protocol level

Agent-Logs-Url: https://github.com/Azure/data-api-builder/sessions/4b68bfc6-9893-4f2e-9772-122e26b21ef1

Co-authored-by: Aniruddh25 <3513779+Aniruddh25@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code based on review comment with integration test Write true integration test for MCP stdio wire output validation May 20, 2026
Copilot AI requested a review from Aniruddh25 May 20, 2026 23:16
@Aniruddh25 Aniruddh25 marked this pull request as ready for review May 20, 2026 23:21
@Aniruddh25 Aniruddh25 merged commit 873d09a into copilot/fix-mcp-null-annotations May 20, 2026
7 checks passed
@Aniruddh25 Aniruddh25 deleted the copilot/add-integration-test-scenario branch May 20, 2026 23:21
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.

2 participants