Skip to main content
Glama

Review a PR change (static + hints + draft comment)

review_pr
Read-onlyIdempotent

Runs static-analysis review checks across a git diff and formats CERT/MISRA rule candidates, idioms, style nits, and functional findings into one Markdown PR comment without posting it.

Instructions

Run check_diff on base..head, build_review_packet for heuristic hints, and format_pr_review into one markdown comment (static table, candidate rules, idioms, style nits, functional bullets). Does not post. Prefer this over three separate calls. profile ceph auto-builds synthetic compdb when needed.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "repo": "<repo>",
      "base": "<base>"
    },
    "name": "review_pr"
  }
}

Input Schema

NameRequiredDescriptionDefault
baseYesBase git ref (merge-base or target branch SHA).
headNoHead ref (PR branch). Default: working tree.
repoYesAbsolute path of the git checkout.
scopeNoOptional scope line; auto-generated when omitted.
titleNoPR title for the comment heading.
toolsNoAnalyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = standalone `clang --analyze` (adds alpha checkers); cppcheck = cppcheck; semgrep = the bundled CERT pattern rules; infer = Infer (null, leak, use-after-free, overflow, race); codeql = the CodeQL CERT query packs, opt-in because each run builds a database (tens of seconds or more). A requested analyzer that is not installed is skipped and listed in `warnings`.
compdbNoAbsolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root/build or root/build-clang.
profileNoReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml file.ceph
standardsNoStandards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ files. Example: ["cert", "misra"].
diff_contextNoOmit to use profile default (ceph: 3).
baseline_pathNoAbsolute path of a baseline JSON written by `cert-review baseline create`. Findings recorded there are left out and counted in `baseline`; file paths in it are relative to its directory. Matching uses rule, file and hashes of the code line and its neighbours, so line shifts do not resurface old findings. Omit to report everything.
min_confidenceNoDrop findings below this confidence. Rule-specific checkers score 0.9, general checkers 0.3-0.65, +0.1 when two tools agree. 0.5 keeps most real hits.
functional_notesNoExtra functional bullets for the comment.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.4.1

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/non-destructive, so the safety bar is covered. The description adds real behavioral context beyond that: it does not post the comment, and `profile ceph` auto-builds a synthetic compdb when one is needed — a side effect an agent could not infer from the schema. Analyzer runtime/skip behavior is left to the schema rather than repeated here.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences: what it runs and produces, what it does not do plus the routing advice, then the compdb caveat. Front-loaded, no redundant restatement of the tool name, and the parenthetical enumeration of output sections is dense but useful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter composition tool with a full output schema, the description covers the essentials: composition, output shape, no posting, and the compdb auto-build. Minor gap: it does not warn that analyzer selection (notably codeql) can be slow, though the tools parameter schema does.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description still earns a bump by explaining the profile→compdb interaction ("profile ceph auto-builds synthetic compdb when needed"), which is a cross-parameter behavior the schema does not state.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific composite action: run check_diff on `base`..`head`, build_review_packet for hints, and format_pr_review into one markdown comment, with the output contents enumerated in parentheses. It also explicitly bounds the scope with "Does not post", so the agent knows this produces a draft only, unlike the format_* siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Prefer this over three separate calls" gives a direct routing rule against the exact composition it wraps, which is the main decision an agent faces here. It stops short of explicit when-not conditions (e.g. call check_diff alone for a quick single-pass check), but the boundary is clear enough in practice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.