Skip to main content
Glama

review_code

Get an independent code review of uncommitted changes by passing a git diff, receiving findings and a verdict before commit.

Instructions

Get an independent code review of your changes before committing. Call this after writing or modifying code. Pass a git diff as input. The diff parameter MUST contain actual git diff output (from git diff, gh pr diff, etc.), NOT a summary or description of changes. To review a branch or landed commits, pass base (and optionally head) instead and the bridge runs git diff base head in cwd. If you reviewed a plan first, pass the same session_id so the reviewer checks the code against the plan. Returns a verdict, findings, responding models, and persistence provenance. An auto-captured review also returns captured_from: the absolute directory the bridge ran git in. If that is not the repository you are working in, pass the diff explicitly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoAbsolute path to the directory this review runs in — the repository or git worktree whose code is being reviewed. Auto-capture, repository instruction files, and the reviewer subprocess all use it. Always pass it: an auto-capturing review without it is refused unless the server is configured with "require_cwd": false, in which case the server's launch directory is used. Must be absolute; "~" is not expanded. Applies to this call only — pass it again on resume.
baseNoReview a committed range instead: the ref to diff FROM (e.g. "main", "origin/main", a commit, or "HEAD~1"). Runs git diff <base> <head> in cwd. Cannot be combined with diff.
diffNoRaw git diff output to review. Must be unified diff format (output of git diff, gh pr diff, etc.). Do NOT pass summaries or descriptions. If omitted, auto-captures changes via git diff HEAD.
headNoThe ref to diff TO when base is given (default: "HEAD"). Requires base.
tierNoPick the reviewing model by capability tier instead of by id: "max" (hardest problems — architecture, concurrency, security, subtle bugs), "balanced" (everyday review), or "fast" (small diffs, precommit sanity, quick iteration). Tiers map per provider (Codex: gpt-6-astra / gpt-5.6-sol / gpt-5.6-luna; Gemini: 3.1 Pro (High) / 3.8 Flash (High) / 3.8 Flash (Medium)) and survive failover. Pass either tier or model, not both.
modelNoOverride the configured default model for this call with a concrete id (e.g. "gpt-5.6-sol") or "latest". To choose by capability use the tier parameter instead (a tier word is still accepted here). May be combined with session_id to change model mid-session; without it a resumed session keeps the model it was recorded with. Compare returned resolved and observed labels for runtime changes.
contextNoIntent of the changes
criteriaNoReview criteria to focus on
auto_diffNoAuto-capture working tree changes (staged + unstaged) via git diff HEAD
deliberateNoPer-call override of the configured review mode: true = both providers review (deliberation); false = single provider with failover. Omit to use the configured mode. Requires a two-provider setup; requesting deliberation under a single-provider config returns an error. Under deliberate-deep, the returned verdict reflects both providers' independent reviews and is NOT recomputed from cross-review adjudications — treat deliberation.divergent[].adjudication as advisory input for your own synthesis.
session_idNoContinue from previous review

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.9.0
    • addedInput schema / additionalProperties
      Added value: +{}
    • changedInput schema / properties / model / description
      Previous value: -"Override the configured default model for this call (e.g., \"gpt-5.6-sol\"), or \"latest\". Or pick a tier instead of a model id: \"max\" (hardest problems — architecture, concurrency, security, subtle bugs), \"balanced\" (everyday review), or \"fast\" (small diffs, precommit sanity, quick iteration). Tiers map per provider (Codex: gpt-6-astra / gpt-5.6-sol / gpt-5.6-luna; Gemini: 3.1 Pro (High) / 3.8 Flash (High) / 3.8 Flash (Medium)) and survive failover. May be combined with session_id to change model mid-session; without it a resumed session keeps the model it was recorded with. Compare returned resolved and observed labels for runtime changes."New value: +"Override the configured default model for this call with a concrete id (e.g. \"gpt-5.6-sol\") or \"latest\". To choose by capability use the tier parameter instead (a tier word is still accepted here). May be combined with session_id to change model mid-session; without it a resumed session keeps the model it was recorded with. Compare returned resolved and observed labels for runtime changes."
    • addedInput schema / properties / tier
      Added value: +{
      +  "description": "Pick the reviewing model by capability tier instead of by id: \"max\" (hardest problems — architecture, concurrency, security, subtle bugs), \"balanced\" (everyday review), or \"fast\" (small diffs, precommit sanity, quick iteration). Tiers map per provider (Codex: gpt-6-astra / gpt-5.6-sol / gpt-5.6-luna; Gemini: 3.1 Pro (High) / 3.8 Flash (High) / 3.8 Flash (Medium)) and survive failover. Pass either tier or model, not both.",
      +  "enum": [
      +    "max",
      +    "balanced",
      +    "fast"
      +  ],
      +  "type": "string"
      +}
  2. First observedv1.8.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden, and it delivers: it discloses that diff must be raw git diff output, that base/head makes the bridge run git diff in cwd, that auto-capture happens via git diff HEAD, and that auto-captured reviews return captured_from. It does not explicitly state read-only behavior or side-effect absence, but 'review' plus the diff-based workflow makes that reasonably clear.

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?

The description is five sentences, front-loaded with purpose and trigger, and every sentence adds necessary behavioral or usage information. It avoids fluff while covering the key modes, constraints, and return values.

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 an 11-parameter tool with no output schema and no annotations, the description covers the core workflow, output composition, auto-capture behavior, and the captured_from edge case. The rich parameter schema handles the remaining parameter-level details. A slightly more explicit statement about the operation being read-only would make it fully complete.

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?

Because schema coverage is 100%, the baseline is 3, and the description adds meaning beyond the schema by explaining the interplay of diff vs base/head, the session_id link to a prior plan review, and the captured_from caveat that tells the agent when to pass diff explicitly. This is meaningful added context, though not every parameter relationship is explored.

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 first sentence, 'Get an independent code review of your changes before committing,' states a specific action and resource. It distinguishes this tool from the sibling review_* tools by focusing on code changes and git diffs, and the rest of the description reinforces that this is the main code-review entry point.

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?

The description gives clear context: 'Call this after writing or modifying code.' It also explains two usage modes (passing a diff, or passing base/head to review a branch) and the plan-review session_id flow. It does not explicitly name sibling tools as alternatives or list when-not-to-use cases, so it stops short of a 5.

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