SIGN IN SIGN UP

feat(mcp): surface domain error codes via _meta (#6)

Tool errors with a defined client recovery now set
_meta["anchor-edit.dev/errorCode"] to a value from the AnchorEditCode
union: ANCHOR_NOT_FOUND, INVALID_RANGE, BINARY_FILE,
ANCHOR_POOL_EXHAUSTED. Each maps to a distinct recovery action
(re-read, fix call shape, switch tool, reset session).

Filesystem, OS, and programmer errors stay opaque: isError=true with
the original message in content[0].text and no _meta. Internal
invariants (anchor/line length agreement, pool non-emptiness) are
trusted in code, not guarded at runtime; bugs that break them surface
through tests.

Per RFC 9457, clients should treat unknown codes as the generic class
so the union can grow without coordinated updates.

The bound is the gRPC / Google AIP-193 / Stripe convention: stable
codes only for conditions a client can branch on programmatically.
J
Jonathan Yang committed
6f8fd830ff04af8ebcfad84a284c011fdd44542a
Parent: ed69fb2
Committed by GitHub <noreply@github.com> on 5/7/2026, 7:58:26 PM