Skip to main content
Glama

review_code

Get an independent code review of your git diff before committing. Pass the raw diff to receive a structured verdict and findings that catch bugs and improve code quality.

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.
modelNoOverride 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.
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. First observedv1.8.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds meaningful context: what the tool returns ('verdict, findings, responding models, and persistence provenance'), what counts as valid diff input, the auto-capture behavior, and the captured_from field. It does not fully disclose side effects like provider calls or failure modes, but for a review tool the key behaviors are surfaced clearly.

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?

The description is longer than average but each sentence earns its place: purpose, when to call, diff format requirements, branch mode, plan linkage, return values, and auto-capture caveat. It is front-loaded with the core purpose and then moves through key usage constraints. It could be tightened slightly, but it remains well-structured for a tool with 10 parameters.

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 complex tool with 10 parameters, no output schema, and no annotations, the description covers the most important contextual information: call timing, input format requirements, alternative input modes, plan continuation, return values, and auto-capture edge case. It does not explain every parameter, but the input schema already covers those in detail. The description is complete enough for an agent to invoke the tool correctly in common scenarios.

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 description coverage is 100%, so the baseline is 3. The description goes beyond the schema by adding critical usage semantics: the diff parameter MUST contain raw git diff output rather than a summary, base/head causes the bridge to run `git diff base head`, and session_id links the review to a previously reviewed plan. This is genuine added value on top of the schema.

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

Purpose4/5

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

The description opens with a specific action and resource: 'Get an independent code review of your changes before committing.' This clearly identifies the tool's purpose and scope. It does not explicitly name sibling tools to differentiate them, but the emphasis on reviewing code changes before committing is enough to distinguish it from review_plan, review_history, review_precommit, and review_status.

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 explicit when-to-use guidance: 'Call this after writing or modifying code.' It also explains the two input modes (raw diff vs. base/head), when to pass session_id, and when to pass diff explicitly (if auto-captured cwd is not the repository). It stops short of explicitly naming alternatives or saying when not to use this tool in favor of a sibling, so it earns a 4 rather than a 5.

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