--json for structured output using a unified envelope schema, so you can chain queries through jq, xargs, and Unix pipes.
JSON Envelope Schema
All--json output follows a consistent envelope structure (schema version 1.0.0):
Envelope Fields
Exit Codes
One exit code carries no envelope: a stale index (built by a binary with different output semantics) refuses with exit
7 and the heal command on stderr — stdout stays empty, so jq receives no input. Gate scripts on the exit code, not only on parsed output.Streaming Mode
codanna dump (v0.14.0+) uses the envelope’s streaming mode: a begin envelope, one result envelope per line for every symbol and relationship, and a terminal summary envelope with totals. The per-line shape makes the whole graph pipeable:
Field Filtering
Use--fields to project data items down to the keys you need. Entries are top-level keys or dotted paths into nested values (symbol.name); output preserves nesting. Top-level shapes differ per tool: find_symbol items carry symbol, file_path, and relationships; search_symbols items carry symbol, score, and highlights. A field whose first segment does not exist at the item’s top level is rejected with an INVALID_QUERY error envelope listing the available fields (exit 2). A deeper segment missing on an individual item omits that leaf for that item only.
data items are filtered; projected output serializes keys alphabetically.
Available with: codanna mcp <tool> --json --fields and codanna retrieve <subcommand> --json --fields
Error Response
Errors include suggestions and context for recovery:Not Found Response
Piping Examples
Extract Data with jq
Chain Commands
Debug with Error Messages
Filter Large Results
Next Steps
CLI Reference
Complete command reference.
Debugging
Troubleshooting and logs.