Skip to content

test: strengthen MCP tool definition contract validation - #1580

Merged
Shashankss1205 merged 1 commit into
CodeGraphContext:mainfrom
jyotish6699:test/mcp-tool-contract-consistency
Aug 8, 2026
Merged

Shashankss1205 merged 1 commit into
CodeGraphContext:mainfrom
jyotish6699:test/mcp-tool-contract-consistency

Conversation

@jyotish6699

Copy link
Copy Markdown
Contributor

Summary

This PR strengthens the MCP contract test suite by adding regression tests that verify the consistency between MCP tool definitions and their corresponding server wrapper methods.

Changes

  • Added a regression test to verify that every tool definition has a matching *_tool wrapper in MCPServer.
  • Added a regression test to verify that every public *_tool wrapper has a corresponding tool definition.
  • Added a regression test to verify that each tool definition's name field matches its registry key.

Why

These tests help prevent regressions when introducing new MCP tools by ensuring that tool definitions and server wrapper methods remain synchronized.

Testing

python -m pytest tests/unit/tools/test_mcp_contracts.py -v
python -m pytest tests/unit/test_tool_definitions.py tests/unit/tools/test_mcp_contracts.py -v

All tests pass successfully.

Closes #1579

Add regression tests to verify tool definitions remain consistent with MCPServer wrapper methods and declared tool names.
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

@jyotish6699 is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Shashankss1205 Shashankss1205 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified locally: trial-merged with #1583, #1586, #1590 and #1591 — full suite green (1153 passed, 7 skipped).

Good contract test. The bidirectional check is the valuable part: test_every_wrapper_has_a_tool_definition catches a wrapper that exists but was never declared, which is the direction that silently ships dead code. Thanks!

@Shashankss1205
Shashankss1205 merged commit efc62c4 into CodeGraphContext:main Aug 8, 2026
17 of 18 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board Aug 8, 2026
Shashankss1205 added a commit that referenced this pull request Aug 8, 2026
Ten PRs since 0.5.6 — mostly parser correctness, all with regression tests.

Parsers
- Ruby nested classes no longer delete their parent; method parameters
  extracted at all (#1523, #1527, #1581)
- C/C++ functions returning a pointer or reference are extracted, and
  registered in pre_scan so they resolve as call targets (#1524, #1582)
- C# fields and locals parsed, restoring receiver-type inference for
  `var x = new T(); x.M();` (#1525, #1584)
- JavaScript destructured, array and rest parameters extracted, recording
  the binding names rather than a placeholder (#1527, #1591)

Queries and analysis
- Five defects that returned wrong answers without erroring: inflated
  repository stats, misattributed callers, discarded graph_name,
  count(*) after OPTIONAL MATCH, an ignored tool argument (#1577)
- Dead-code detection made correct and self-consistent, including the
  JS module-level false positive (#600, #1559, #1578)

Indexing
- add_package_to_graph on a flat module no longer indexes the whole
  virtualenv (#1528, #1586)
- SCIP job progress no longer exceeds 100% (#1535, #1583)

Docs and tests
- Database Options table columns realigned (#1590)
- MCP tool definition contract validation (#1580)

Co-authored-by: Claude Fable 5 <[email protected]>
@Shashankss1205 Shashankss1205 added gssoc:approved GSSoC validation: counts toward scoring level:intermediate GSSoC difficulty: 35 pts contributor / 20 mentor mentor:Shashankss1205 GSSoC mentor attribution: credits reviewing mentor quality:clean GSSoC quality: x1.2 contributor / +5 mentor type:testing GSSoC type bonus: testing labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC validation: counts toward scoring level:intermediate GSSoC difficulty: 35 pts contributor / 20 mentor mentor:Shashankss1205 GSSoC mentor attribution: credits reviewing mentor quality:clean GSSoC quality: x1.2 contributor / +5 mentor type:testing GSSoC type bonus: testing

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Strengthen MCP tool definition and wrapper contract tests

2 participants