Skip to main content
Glama

Build a SEI CERT review packet

build_review_packet
Read-onlyIdempotent

Build a review packet of code hunks and candidate SEI CERT rules that analyzers cannot decide, then validate findings.

Instructions

Build a packet for reviewing code against SEI CERT rules that analyzers cannot decide: code hunks, each with up to max_rules_per_hunk candidate rules (picked by token/API heuristics and profile idioms, rules fully covered by a specific checker left out) and their text excerpts. Diff mode (repo plus base or diff_text): changed lines with 3 lines of context. Path mode (path): whole files. Hunks are cut into 60-line windows. Use after check_diff or check_files; judge each hunk, then send your findings to validate_findings. Read-only; run_static=true also runs the analyzers (same cost as check_diff/check_files) to mark lines already reported. Output is large, roughly 5-25 KB per hunk.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "build_review_packet"
  }
}

Input Schema

NameRequiredDescriptionDefault
baseNoDiff mode: base git ref; required with repo unless diff_text is given.
headNoDiff mode: head git ref; omit for the working tree.
pathNoPath mode: absolute path of a file or directory. Ignored when diff mode applies.
repoNoDiff mode: absolute path of the git checkout.
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.default
diff_textNoDiff mode: unified diff text, paths relative to repo.
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"].
run_staticNoAlso run the analyzers and list their findings per hunk so they are not repeated. Set false if you already ran check_diff/check_files.
diff_contextNoLines around a change to include in static analysis (confidence * 0.85).
min_confidenceNoMinimum confidence for bundled static analysis when run_static is true.
max_rules_per_hunkNoCandidate rules per hunk. Omit to use the profile's value (6 in both bundled profiles).

Output Schema

NameRequiredDescriptionDefault
hunksYesfile (absolute), start_line, end_line, code (line-numbered), idioms[] {id, hint}, candidate_rules[] {rule_id, title, tier, matched, severity, priority, level, profile_note, text (<= 3500 chars), url}, existing_findings[] {rule_id, line, checker}.
profileYes
instructionsYesHow to review the hunks and what makes a finding acceptable.
rule_databaseYesCommit of the bundled rule database.
skipped_hunksYes[file, start_line, end_line] of hunks with no candidate rule.
finding_schemaYesFields each finding must have: rule_id, file, line, message, quote; optional severity, fix, confidence.
static_findingsYesAnalyzer findings for the same scope; [] when run_static=false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.4.1

TDQS

A4.7/5.0
Behavior4/5

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

Goes beyond the readOnly/idempotent/non-destructive annotations by disclosing cost ('same cost as check_diff/check_files' when run_static=true) and output volume ('roughly 5-25 KB per hunk'), plus the 60-line windowing and 3-line diff context. That is meaningful operational context an agent needs for budgeting. Minor gap: it doesn't say what happens when no hunks qualify or how warnings surface, though the latter is documented in the schema.

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?

Front-loaded with purpose, then mode rules, then workflow routing, then cost/size caveats. The long parenthetical in sentence one is dense but carries real information about rule selection, and no sentence is filler.

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

Completeness5/5

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

For a 13-parameter tool with an output schema, the description supplies the mode logic, workflow position, cost, and payload size that the schema cannot convey. Return-value details are correctly left to the output schema.

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 baseline would be 3; the description adds mode-selection semantics above that by spelling out diff mode (repo plus base or diff_text) versus path mode and the heuristic basis for candidate rule selection. One small inconsistency: it says changed lines come with '3 lines of context' while the diff_context parameter defaults to 0, which an agent may find ambiguous.

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 verb and resource (build a review packet), then defines exactly what the packet contains: hunks with up to max_rules_per_hunk candidate rules, text excerpts, and the exclusion of rules a specific checker fully covers. This distinguishes it from check_diff/check_files, which produce findings rather than review material.

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

Usage Guidelines5/5

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

Explicitly sequences the tool: run after check_diff or check_files, judge each hunk, then send findings to validate_findings. It also gives the run_static=false exemption and explains when to leave it true, so an agent knows both the position in the workflow and the conditions for each choice.

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