Skip to content
Docs menu

Tool reference · Tasks, workflows & decisions

file_context

Before you edit a file, shows past errors, lessons and rules that mention it, plus a risk score from 0 to 1.

local stdio server read-only

When to use

  • You are about to change a file that has caused problems before.
  • You want to know whether a fix for this file is still open.
  • You want project conventions that apply to a specific path.

Parameters

NameTypeDefaultDescription
pathrequired string — —
project string — —
limit integer 20 —

Example

Arguments

{
  "path": "src/billing/invoice.py",
  "project": "billing-api"
}

Result shape

{
  "file": "src/billing/invoice.py",
  "risk_score": 0.54,
  "summary": "⚠️  src/billing/invoice.py: risk=0.54 · 1 past error(s) · 1 unresolved · 1 related lesson(s)/conventions",
  "warnings": [
    {
      "source": "error",
      "severity": "high",
      "category": "bug",
      "content": "Rounding error on multi-currency totals",
      "context": "src/billing/invoice.py line 88",
      "fix": "Use Decimal with ROUND_HALF_EVEN",
      "status": "open",
      "created_at": "2026-09-10T14:02:00Z",
      "resolved_at": null,
      "error_id": 212
    },
    {
      "source": "knowledge",
      "severity": "high",
      "type": "lesson",
      "content": "Never use float for money in src/billing/invoice.py",
      "context": "",
      "confidence": 1,
      "created_at": "2026-09-11T09:20:00Z",
      "recall_count": 4,
      "knowledge_id": 3990
    }
  ],
  "related_rules": []
}

Matches by path in tags or text. With no matches the score is 0 and the summary says to proceed normally.

Values are illustrative; the keys follow the server's handler. MCP clients receive the result as JSON text content.

Server description

The description the server sends to your agent in tools/list, captured from the v14.7.0 source:

BEFORE editing a file, call this to surface past errors, lessons, and related rules for that file path. Returns risk_score ∈ [0, 1].

Found a mistake? Open an issue on GitHub.

Search