Skip to content

fix(mcp): align tool schemas with accepted inputs#1021

Merged
ben-ranford merged 1 commit into
mainfrom
fix/mcp-copilot-review-fixes
Jun 10, 2026
Merged

fix(mcp): align tool schemas with accepted inputs#1021
ben-ranford merged 1 commit into
mainfrom
fix/mcp-copilot-review-fixes

Conversation

@ben-ranford

Copy link
Copy Markdown
Owner

Summary

Addresses unresolved Copilot review feedback from the merged MCP PR by tightening the advertised MCP tool contracts and no-argument decoding behavior.

Changes

  • Advertises topN in the single-dependency MCP tool schema because the argument is accepted and ignored for dependency runs.
  • Adds anyOf alternatives to the baseline comparison schema for baselinePath or baselineStorePath plus baselineKey.
  • Treats JSON null params/arguments as empty objects in strict MCP decoding.

Validation

Commands and checks run:

go test ./internal/mcp
go test ./...
make lint
pre-commit make ci

Additional manual validation:

Risk and compatibility

  • Breaking changes: None
  • Migration required: None
  • Performance impact: None expected; schema/decoder-only contract fix.
  • Memory benchmark impact: None; pre-commit memory benchmark gate passed with no meaningful delta.

Checklist

  • Tests added/updated for behavior changes
  • Docs updated (README/docs/schema) if needed
  • memory-approved requested/applied if intentional memory benchmark regressions exceed CI thresholds
  • No unrelated changes included
  • Ready for review

Copilot AI review requested due to automatic review settings June 10, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 topN as an accepted (ignored) argument for the single-dependency analysis tool schema.
  • Express baseline comparison inputs as schema alternatives: baselinePath or (baselineStorePath + baselineKey).
  • Treat JSON null as {} 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.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Memory Benchmarks

Thresholds: bytes/op <= +15.0%, allocs/op <= +10.0%

Benchmark Base B/op Head B/op Delta B/op Base allocs/op Head allocs/op Delta allocs/op Status
github.com/ben-ranford/lopper/internal/lang/shared/BenchmarkCountUsage 25632.0 25632.3 +0.0% 375.0 375.0 +0.0% ok
github.com/ben-ranford/lopper/internal/lang/shared/BenchmarkCountUsageRegexPerIdentifier 413244.7 414130.0 +0.2% 3067.0 3067.0 +0.0% ok
github.com/ben-ranford/lopper/internal/report/BenchmarkFormatLargeTable 256581.3 256578.0 -0.0% 3079.0 3079.0 +0.0% ok

Result: memory benchmark gate passed.

Approval: not required.

@github-actions

Copy link
Copy Markdown
Contributor

Lopper (Delta)

Metric delta Value
Dependency count +0
Used percent +0.0%
Waste percent +0.0%
Estimated unused bytes +0 B
Known licenses +0
Unknown licenses +0
Denied licenses +0
Changed Regressions Progressions Added Removed Unchanged
0 0 0 0 0 9

No dependency-surface deltas detected.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

SonarQube (PR)

Open issues: 0
Actionable issues shown (excluding mock/fixture files): 0

Duplication

  • Overall duplicated lines: 768
  • Overall duplication density: 0.60%
  • New duplicated lines: n/a
  • New duplication density: n/a

Issues

Open Sonar issues (0)
# Severity Rule Location Message
- - - - No open Sonar issues for this PR.

Source: SonarCloud PR view

@ben-ranford ben-ranford force-pushed the fix/mcp-copilot-review-fixes branch from a8d942c to cf6cf4d Compare June 10, 2026 20:58
@sonarqubecloud

Copy link
Copy Markdown

@ben-ranford ben-ranford merged commit 9f7e598 into main Jun 10, 2026
10 checks passed
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