fix(mcp): align tool schemas with accepted inputs#1021
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens the MCP stdio tool contracts to better match actual accepted inputs and makes strict decoding more tolerant of JSON null for params/arguments, addressing the remaining review feedback from PR #1020.
Changes:
- Advertise
topNas an accepted (ignored) argument for the single-dependency analysis tool schema. - Express baseline comparison inputs as schema alternatives:
baselinePathor (baselineStorePath+baselineKey). - Treat JSON
nullas{}during strict MCP decoding, with added test coverage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/mcp/tools.go | Updates MCP tool input schemas and makes decodeStrict treat null as an empty object. |
| internal/mcp/server_test.go | Extends tools/list coverage to assert the updated schema shape (topN presence and baseline anyOf). |
| internal/mcp/coverage_test.go | Adds a branch test ensuring decodeStrict accepts null arguments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Memory BenchmarksThresholds: bytes/op <= +15.0%, allocs/op <= +10.0%
Result: memory benchmark gate passed. Approval: not required. |
Lopper (Delta)
No dependency-surface deltas detected. |
SonarQube (PR)Open issues: 0 Duplication
IssuesOpen Sonar issues (0)
Source: SonarCloud PR view |
a8d942c to
cf6cf4d
Compare
|



Summary
Addresses unresolved Copilot review feedback from the merged MCP PR by tightening the advertised MCP tool contracts and no-argument decoding behavior.
Changes
topNin the single-dependency MCP tool schema because the argument is accepted and ignored for dependency runs.anyOfalternatives to the baseline comparison schema forbaselinePathorbaselineStorePathplusbaselineKey.nullparams/arguments as empty objects in strict MCP decoding.Validation
Commands and checks run:
Additional manual validation:
Risk and compatibility
Checklist
memory-approvedrequested/applied if intentional memory benchmark regressions exceed CI thresholds