Skip to content

Lint prompts (MCPP017-MCPP024) - #32

Merged
ShmueLior merged 7 commits into
mainfrom
feat/prompt-lint
Dec 4, 2026
Merged

ShmueLior merged 7 commits into
mainfrom
feat/prompt-lint

Conversation

@ShmueLior

Copy link
Copy Markdown
Owner

Lint prompts (MCPP017-MCPP024)

lint and LintToolsAsync now also check prompts when the server declares the prompts capability. If it doesn't, prompts/list is not sent, so tool-only servers behave as before. --from-file still lints tools only, since snapshots don't carry prompts.

New rules, all on by default:

Id Default Checks
MCPP017 warning The prompt has a description.
MCPP018 warning The prompt description isn't too short (same limits as MCPP002).
MCPP019 warning Every prompt argument has a description.
MCPP020 warning The prompt name follows the tool-name guidance.
MCPP021 warning Prompt names use one style.
MCPP022 warning Prompt argument names use one style.
MCPP023 info Prompt argument names aren't vague.
MCPP024 warning The prompt description says more than the name or title.
  • LintFinding.Kind (LintTargetKind: Tool, Prompt, Resource, ResourceTemplate) is new and init-only. Reports print prompt before the name.
  • Lint baselines and ignore entries take an optional kind. If it's missing, the entry matches any kind. Writing a baseline adds kind for non-tool findings.
  • Baseline or ignore entries for prompts aren't called stale or unused when prompts weren't listed.
  • New overload ToolLinter.Lint(surface, prompts, options). Lint(surface, null) still picks the old options overload.
  • Unknown-rule test fixtures now use MCPP999 instead of MCPP008.

Heads up: servers with prompts that have no descriptions or undescribed arguments can start failing default lint. Turn the rules off with --rule MCPP017=none through --rule MCPP024=none, or use ignore or a baseline.

JSON lint findings include an optional kind (prompt, resource or resourceTemplate); it is omitted for tools, so the top-level report kind stays lint. Lint SARIF fingerprints are ruleId|kind|tool|path. Diff fingerprints are unchanged.

Tests: full suite 1482 passed on net8.0 and net10.0, Release, 0 warnings. Rebased onto main after PR #30 (F14).

This branch was rebased onto main (c4485b3). Conflicts were resolved by keeping both sides: CHANGELOG (prompt-lint bullet first, then F14/F15/F16); CliApp (F14 --format/--sarif and WriteOutputAsync, plus prompt-aware lint); ServerOptions (FromFilePath plus CaptureForLintAsync).

Likely remaining conflicts:

A nullable prompts argument next to Lint(surface, LintOptions?) made Lint(surface, null) ambiguous. The prompts parameter is now required, so existing callers that pass null still mean options. The root help text now mentions prompts.
Lint JSON keeps the existing report format and adds an optional finding-level kind (prompt, resource or resourceTemplate), omitted for tools. Lint SARIF fingerprints are ruleId|kind|tool|path. Diff fingerprints are unchanged.
JsonKind for a tool is "tool", and lint SARIF always passed it into the fingerprint, so tool findings hashed as ruleId|tool|name|path instead of format 1's ruleId|name|path on main. Pass a kind only for non-tool findings. Diff fingerprints were already unchanged.
Keep the prompt-lint CHANGELOG bullet and the icons bullet from #31, and keep both the prompt/fingerprint tests and DiffJson_IconChange_IsIconsChanged.
@ShmueLior
ShmueLior merged commit ba49064 into main Dec 4, 2026
3 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.

1 participant