Build a SEI CERT review packet
build_review_packetBuild 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
| Name | Required | Description | Default |
|---|---|---|---|
| base | No | Diff mode: base git ref; required with repo unless diff_text is given. | |
| head | No | Diff mode: head git ref; omit for the working tree. | |
| path | No | Path mode: absolute path of a file or directory. Ignored when diff mode applies. | |
| repo | No | Diff mode: absolute path of the git checkout. | |
| tools | No | Analyzers 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`. | |
| compdb | No | Absolute 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. | |
| profile | No | Review 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_text | No | Diff mode: unified diff text, paths relative to repo. | |
| standards | No | Standards 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_static | No | Also 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_context | No | Lines around a change to include in static analysis (confidence * 0.85). | |
| min_confidence | No | Minimum confidence for bundled static analysis when run_static is true. | |
| max_rules_per_hunk | No | Candidate rules per hunk. Omit to use the profile's value (6 in both bundled profiles). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hunks | Yes | file (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}. | |
| profile | Yes | ||
| instructions | Yes | How to review the hunks and what makes a finding acceptable. | |
| rule_database | Yes | Commit of the bundled rule database. | |
| skipped_hunks | Yes | [file, start_line, end_line] of hunks with no candidate rule. | |
| finding_schema | Yes | Fields each finding must have: rule_id, file, line, message, quote; optional severity, fix, confidence. | |
| static_findings | Yes | Analyzer findings for the same scope; [] when run_static=false. |