Skip to content
Docs menu

Tool reference · Errors, rules & self-improvement

learn_error

Records an error with its file, root cause, fix and a pattern name, and creates a prevention rule automatically once the same pattern repeats.

local stdio server writes

When to use

  • You fixed a bug and know its root cause and a general pattern behind it.
  • The same kind of error keeps appearing in different files.
  • You want file_context to warn about this file next time.

Parameters

NameTypeDefaultDescription
filerequired string — —
errorrequired string — —
root_causerequired string — —
fixrequired string — —
patternrequired string — —
severity "low" | "medium" | "high" | "critical" "medium" —
category string "bug" —
project string "general" —

Example

Arguments

{
  "file": "src/Service/OrderService.php",
  "error": "Duplicate order created on webhook retry",
  "root_cause": "No idempotency check on incoming webhook",
  "fix": "Check Idempotency-Key before insert",
  "pattern": "missing-idempotency",
  "severity": "high",
  "project": "my-api"
}

Result shape

{
  "error_id": 612,
  "pattern": "missing-idempotency",
  "consolidated": false,
  "rule_id": null
}

After 3 errors share a pattern, consolidated becomes true and rule_id points to the new rule.

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:

Structured error capture: file, error, root_cause, fix, pattern. After N (default 3) errors share the same pattern, a prevention rule is auto-synthesized into the rules table.

Found a mistake? Open an issue on GitHub.

Search