Skip to main content
Glama

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

review_pr
Read-onlyIdempotent

Generates a single Markdown PR review comment by diffing base..head, collecting analyzer hints and style/functional findings, and formatting them without posting.

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.
github_footerNoAppend collapsible footer: pull_request_target, mcp, github-action. Omit when drafting for manual paste.
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. Addedv1.4.1

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotentHint/destructiveHint, so the safety profile is covered; the description still adds value by confirming 'Does not post' and by disclosing that the ceph profile auto-builds a synthetic compdb. It doesn't mention runtime cost of the heavier analyzers or how skipped analyzers are surfaced, but the output schema covers return shape.

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

Conciseness4/5

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

Three sentences, front-loaded with the pipeline and followed by the non-posting boundary and the compdb note; nothing is wasted. The first sentence is densely parenthetical, but the parentheses carry real information about the produced comment.

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

Completeness3/5

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

For a 14-parameter orchestration tool with an output schema and strong annotations, the description covers the pipeline, output artifact, and the compdb edge case, but says nothing about how warnings, baseline suppression, or min_confidence filtering affect the result. Those are documented per-parameter in the schema, so the gap is moderate rather than critical.

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?

With 100% schema coverage the baseline is 3, and the description earns a bump by documenting a cross-parameter behavior absent from the schema: the ceph profile auto-builds a synthetic compdb when one is needed, which changes the meaning of omitting `compdb`. The `base`..`head` range framing also clarifies the two required parameters.

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?

The description names the exact composition — check_diff over `base`..`head`, build_review_packet for hints, format_pr_review for the markdown comment — and enumerates the comment's sections (static table, candidate rules, idioms, style nits, functional bullets). It also states a boundary ('Does not post'), so an agent can distinguish this from the three sibling tools it orchestrates.

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' is an explicit routing instruction naming the alternatives, which is the main selection decision here. It lacks a when-not condition (e.g., when only the raw diff is needed, call check_diff directly), so it stops just short of full coverage.

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