ollama_code_review
Code review. REVIEW. Given a unified diff (and optional source_paths for context), returns STRUCTURED FINDINGS: {findings:[{severity, category, file, line?, symbol?, description, recommendation}], summary, diff_size_bytes}. Severity enum critical|high|medium|low; category enum bug|security|performance|style|maintainability. Distinct from ollama_multi_file_refactor_propose (proposes refactors) — code_review flags issues to fix on the diff as-is. Optional severity_floor filters out below-floor findings; max_findings caps result. Diff capped at 2MB; source_paths max 50. Tier defaults to workhorse; pass tier:'deep' for high-stakes review. coerceReview drops malformed entries instead of throwing.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
diff_text |
string | yes | — | Unified diff text (e.g. git diff output). Required. Max 2 MB to keep prompts within sensible context budgets — for larger reviews chunk the diff per logical change. Field name matches changePack / changeBrief convention. |
source_paths |
string[] | no | — | Optional full source files for the changed locations. Provides the model with full context for cross-line/cross-symbol concerns (e.g. ‘this rename breaks line 200 in the same file the diff only touches line 50’). Max 50 paths. |
severity_floor |
"critical" \ |
"high" \ |
"medium" \ |
"low" |
max_findings |
integer | no | 50 |
Cap on returned findings after filtering. Default 50, max 200. The cap protects against a chatty model on a small diff burying real signal. |
tier |
"instant" \ |
"workhorse" \ |
"deep" |
no |
Full input schema
Section titled “Full input schema”The JSON Schema below is generated from the same zod schema the server validates against at the wire — it cannot drift from runtime behavior.
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "diff_text": { "type": "string", "minLength": 1, "maxLength": 2097152, "description": "Unified diff text (e.g. `git diff` output). Required. Max 2 MB to keep prompts within sensible context budgets — for larger reviews chunk the diff per logical change. Field name matches changePack / changeBrief convention." }, "source_paths": { "description": "Optional full source files for the changed locations. Provides the model with full context for cross-line/cross-symbol concerns (e.g. 'this rename breaks line 200 in the same file the diff only touches line 50'). Max 50 paths.", "maxItems": 50, "type": "array", "items": { "type": "string", "minLength": 1 } }, "severity_floor": { "description": "Drop findings below this severity from the result. Default 'low' (returns everything).", "default": "low", "type": "string", "enum": [ "critical", "high", "medium", "low" ] }, "max_findings": { "description": "Cap on returned findings after filtering. Default 50, max 200. The cap protects against a chatty model on a small diff burying real signal.", "default": 50, "type": "integer", "minimum": 1, "maximum": 200 }, "tier": { "description": "Which tier to run on. 'workhorse' is the default; 'deep' is recommended for security-critical or high-stakes reviews; 'instant' for fast smoke passes on tiny diffs.", "default": "workhorse", "type": "string", "enum": [ "instant", "workhorse", "deep" ] } }, "required": [ "diff_text" ]}Envelope
Section titled “Envelope”Every tool returns the standard envelope — tier_used, model, tokens_in/tokens_out, elapsed_ms, backend provenance, warnings. See Envelope & tiers.
Source
Section titled “Source”Schema + handler: src/tools/codeReview.ts · registration: src/index.ts
Back to the Tool Reference.