Skip to content

test(harness): implement MCP JSON-RPC test harness#2828

Merged
anubhav756 merged 2 commits intomainfrom
anubhav-tests-harness-migration
Mar 31, 2026
Merged

test(harness): implement MCP JSON-RPC test harness#2828
anubhav756 merged 2 commits intomainfrom
anubhav-tests-harness-migration

Conversation

@anubhav756
Copy link
Copy Markdown
Contributor

@anubhav756 anubhav756 commented Mar 24, 2026

Overview

This PR introduces the native MCP test harness, enabling us to run integration tests using the JSON-RPC protocol over /mcp.

Changes

  • Added tests/mcp_execute.go and tests/mcp_types.go as the core harness for invoking MCP tools and asserting responses.
  • Updated tests/server.go to support dynamic flags like --enable-api.
  • Added unit/integration tests in internal/server/server_test.go to verify the harness itself.

Checklist

  • Ensure the tests and linter pass

@anubhav756 anubhav756 requested a review from Yuan325 March 24, 2026 16:48
@anubhav756 anubhav756 self-assigned this Mar 24, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a dedicated test helper for the MCP JSON-RPC interface. The primary goal is to simplify the process of invoking and validating tool calls within the test suite, thereby improving testability and reducing boilerplate code for future MCP-related tests.

Highlights

  • New MCP JSON-RPC Test Helper: A new Go function, ExecuteMCPToolCall, has been implemented to streamline the testing of MCP JSON-RPC tool calls. This helper abstracts away the complexities of request construction, HTTP communication, and response parsing, making it easier to write and maintain tests for MCP functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new test helper function, ExecuteMCPToolCall, in tests/mcp_execute.go. This function streamlines the process of making MCP tool calls within integration tests, handling request marshaling, HTTP communication, and response parsing. Feedback includes addressing the concatenation of multiple TextContent parts in the MCP response to ensure valid JSON output, and handling the error returned by json.Marshal during request body preparation.

Base automatically changed from anubhav-server-migration to anubhav-api-consolidation March 24, 2026 16:59
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch from 34fdbff to e88fd7a Compare March 24, 2026 17:06
@anubhav756 anubhav756 force-pushed the anubhav-api-consolidation branch from eacda15 to 62d28eb Compare March 24, 2026 17:06
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch 3 times, most recently from 6070a58 to 9c40b34 Compare March 24, 2026 17:24
@anubhav756 anubhav756 marked this pull request as ready for review March 24, 2026 18:02
@anubhav756 anubhav756 requested a review from a team as a code owner March 24, 2026 18:02
@anubhav756 anubhav756 marked this pull request as draft March 25, 2026 04:04
@anubhav756 anubhav756 closed this Mar 25, 2026
@anubhav756 anubhav756 reopened this Mar 25, 2026
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch from 55c33c7 to 8b9a9f8 Compare March 25, 2026 04:27
@anubhav756 anubhav756 force-pushed the anubhav-api-consolidation branch from d8817ea to 163bba2 Compare March 25, 2026 06:15
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch from 8b9a9f8 to 77e10c4 Compare March 25, 2026 06:15
@anubhav756 anubhav756 marked this pull request as ready for review March 25, 2026 06:36
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch from 3633430 to 082e280 Compare March 29, 2026 15:58
@anubhav756 anubhav756 requested a review from Yuan325 March 30, 2026 04:26
@anubhav756 anubhav756 changed the title test(harness): implement MCP JSON-RPC test helper test(harness): implement MCP JSON-RPC test harness Mar 30, 2026
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch 2 times, most recently from e0686e3 to bc7fa2f Compare March 30, 2026 12:38
@anubhav756 anubhav756 force-pushed the anubhav-api-consolidation branch 2 times, most recently from 5fcb79a to c5fc0aa Compare March 30, 2026 12:40
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch 2 times, most recently from 7fe2c51 to 37f4fdb Compare March 30, 2026 12:54
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch from 37f4fdb to 2035569 Compare March 30, 2026 13:46
@anubhav756 anubhav756 force-pushed the anubhav-api-consolidation branch from c5fc0aa to f8592e5 Compare March 30, 2026 13:50
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch 3 times, most recently from 35c785b to 55c54c6 Compare March 30, 2026 14:18
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch from 55c54c6 to 4349247 Compare March 30, 2026 21:36
@anubhav756 anubhav756 requested a review from Yuan325 March 30, 2026 21:39
@anubhav756 anubhav756 force-pushed the anubhav-api-consolidation branch from 5c22f0e to 0d44d89 Compare March 30, 2026 21:42
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch 2 times, most recently from 49352dc to 009f45b Compare March 30, 2026 22:13
Base automatically changed from anubhav-api-consolidation to main March 31, 2026 10:37
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch from b934ec8 to 5364cf1 Compare March 31, 2026 11:03
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
@anubhav756 anubhav756 force-pushed the anubhav-tests-harness-migration branch from 5364cf1 to 4b41e0d Compare March 31, 2026 11:11
@anubhav756 anubhav756 merged commit 52146c5 into main Mar 31, 2026
19 checks passed
@anubhav756 anubhav756 deleted the anubhav-tests-harness-migration branch March 31, 2026 12:04
@github-actions
Copy link
Copy Markdown
Contributor

🧨 Preview deployments removed.

Cloudflare Pages environments for pr-2828 have been deleted.

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