Skip to content

Implement MCPP008: flag required entries with no matching property - #25

Open
ShmueLior wants to merge 2 commits into
mainfrom
mcpp008-required-property-not-defined
Open

ShmueLior wants to merge 2 commits into
mainfrom
mcpp008-required-property-not-defined

Conversation

@ShmueLior

@ShmueLior ShmueLior commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Adds the MCPP008 lint rule: flags a name in required that has no matching entry in properties (commonly left behind after a parameter rename). Checks inputSchema only.
  • Runs by default (like MCPP001-MCPP007); with --nested/CheckNestedParameters, also checks nested object properties and array items.
  • Composition: allOf branches are unioned into the check (following local $refs inside a branch); anyOf/oneOf are skipped entirely, since only one branch has to apply and we can't tell which statically (same caution MCPP016 already uses for enums under combinators).
  • A required entry written alongside a $ref is checked against the ref's resolved properties (via TryResolveRef), not dropped — this runs for every visited node, including the top level, regardless of CheckNestedParameters. An unresolved $ref is skipped to avoid false positives.

Fixes #8

Review feedback addressed

  • False positives on allOf/anyOf/oneOf composition — fixed per above.
  • Sibling required next to a $ref was being dropped by the walk's plain ref swap — now resolved independently via TryResolveRef.
  • Rebased onto main (Add discoverability tags and README opening line #24 merged); kept both CHANGELOG Unreleased sections.
  • Nested finding messages now quote the full path (Property 'home.floor'...), matching MCPP003/MCPP007.
  • README row now notes MCPP008 checks inputSchema only.

Test plan

  • Unit tests for: top-level cases, severity override, empty/missing properties, duplicate required entries, multiple missing names, allOf union (plain and through a $ref branch), allOf with a name missing across all branches, anyOf/oneOf skip, $ref + sibling required (defined and missing cases, with and without --nested), unresolvable $ref + sibling required, nested objects and array items
  • dotnet test --solution McpProbe.slnx -c Release: 1254/1254 passed (net8.0 and net10.0), 0 analyzer warnings
  • Updated README, CHANGELOG, docs/mcpprobe.schema.json, and PublicAPI.Unshipped.txt

https://claude.ai/code/session_01RKdT6qJ3EG6ptrGZ1zEnXX


Generated by Claude Code

A tool's input schema can list a name in `required` that isn't defined
in `properties`, usually after a parameter rename that forgot to
update `required`. This adds the lint rule for it, running by default
like MCPP001-MCPP007; with --nested it also checks nested objects and
array items. A property defined through a local $ref counts as
defined, and an unresolved $ref is skipped to avoid false positives.

Fixes #8

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKdT6qJ3EG6ptrGZ1zEnXX
- allOf branches are unioned into the required/properties check
  (following local $ref inside a branch); anyOf/oneOf are skipped
  entirely rather than guessing which branch applies, matching the
  caution MCPP016 already uses for enums under combinators.
- A required entry written alongside a $ref is now checked against
  the ref's resolved properties (via TryResolveRef) instead of being
  dropped by the walk's plain TryFindTarget swap. This runs for every
  visited node, including the top level, regardless of
  CheckNestedParameters.
- Nested finding messages now quote the full path ("Property
  'home.floor'...") like MCPP003/MCPP007, not the bare name.
- README notes MCPP008 only checks inputSchema.
- Rebased onto main (#24 merged); kept both CHANGELOG sections.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKdT6qJ3EG6ptrGZ1zEnXX
@ShmueLior
ShmueLior force-pushed the mcpp008-required-property-not-defined branch from 616a91a to 9cdf827 Compare November 29, 2026 17:53
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.

Lint: flag required entries that have no matching property (MCPP008)

2 participants