Reference
JSON Response Schemas & the MCP Tool
Machine-readable response fields verified against Rust structs, and the single MCP tool that takes CLI arguments.
Exact JSON response types serialized from Rust structs in src/, and the schema of the one MCP tool in src/mcp.rs.
Status Enum & ErrorInfo#
Status:"complete"|"empty"|"invalid_query"|"unsupported"|"conflict"ErrorInfo:{"message": string, "pos"?: number}(pospopulated on LQL parse failures)
CLI --json Response Payloads#
Search / Read / Edit / Rename
// Response (lancet '<QUERY>' --json)
{
"status": "complete", "query": ""spin_lock" in file", "mode": "auto",
"matched": 7073, "matched_is_lower_bound": false, "returned": 20, "truncated": true,
"results": [{
"id": "...", "path": "kernel/locking/spinlock.c", "unit": "file",
"start_line": 12, "end_line": 44, "symbol": "raw_spin_lock",
"lines": [{ "line": 12, "text": "...", "context": false }], "more_lines": 0
}],
"terms": [{ "term": "spinlock", "count": 42, "files": 19 }],
"budget": { "limit_tokens": 1500, "used_tokens": 1120, "estimated": true },
"stats": { "files_considered": 86218, "files_searched": 7814, "files_matched": 7073, "index_candidates": 7814, "stale_files": 0, "elapsed_ms": 141.3 }
}
// ReadResponse (rev omitted on binary documents & archives; multiple targets return { status, results: [ReadResponse, ...] })
{ "status": "complete", "path": "src/net.rs", "rev": "e70d5a898f122a62", "section": "fn retry_limit", "total_lines": 80, "start_line": 1, "end_line": 4, "returned_lines": 4, "truncated": false, "next_line": null, "estimated_tokens": 28, "lines": [{ "num": 1, "text": "..." }], "elapsed_ms": 0.4 }
// EditResponse (mode: "dry-run" | "applied")
{ "status": "complete", "mode": "applied", "path": "src/net.rs", "rev": "e70d5a898f122a62", "rev_after": "1486bdffbc06c68f", "start_line": 2, "end_line": 2, "hunks": [[2, 2]], "applied": true, "diff": "...", "elapsed_ms": 1.1 }
// RenameResponse (tier: "local-scope")
{ "status": "complete", "mode": "applied", "path": "src/search.rs", "old": "old_n", "new": "new_n", "tier": "local-scope", "rev": "...", "rev_after": "...", "declaration": { "line": 40, "col": 9 }, "sites": [{ "line": 40, "col": 9 }], "comment_mentions": 0, "applied": true, "elapsed_ms": 2.3 }Fd / Outline / Refs / Rank / Ast / Patch / Explain
// FdResponse: { status, mode, total, returned, truncated, entries: [{ path, kind, file_type?, size?, mtime_ns? }], elapsed_ms }
// OutlineResponse: { status, files: [{ path, file_type, total_lines?, items: [{ kind, name, depth, start_line?, end_line?, signature?, detail? }] }], total_items, truncated, elapsed_ms }
// RefsResponse: { status, mode, symbol, definitions: [RefHit], references: [RefHit], total_references, truncated, stats }
// RankResponse: { status, mode, pattern, entries: [{ name, kind, path, line, references, definitions }], total, truncated, files_parsed, elapsed_ms }
// AstResponse: { status, mode, lang?, pattern, matched, returned, truncated, matches: [AstMatch], diffs: [FileDiff], stats }
// PatchResponse: { status, mode, applied, files: [{ path, action, from?, hunks, offsets, rev?, rev_after?, diff }], elapsed_ms }
// ExplainResponse: { status, canonical?, ir?, trigram_req?, index_exists, files_considered, index_candidates?, stale_files?, selectivity_pct?, grams_available?, grams_decoded?, elapsed_ms }MCP: the lancet tool#
Protocol revisions: 2025-03-26, 2024-11-05. JSON-RPC errors: -32700 (parse error), -32600 (invalid request), -32601 (unknown method), -32602 (unknown tool). One tool:
inputSchema
{
"type": "object",
"properties": {
"args": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
"stdin": { "type": "string" },
"max_output_bytes": { "type": "integer", "minimum": 256, "default": 131072 }
},
"required": ["args"],
"additionalProperties": false
}args is the CLI command line (see the CLI reference); add "--json" to get the payloads above. The text result is stdout, then stderr, then [exit N] for a non-zero exit; isError is true for exit 2 only. --read-only servers refuse edit, patch, rename, index and --apply, and report readOnlyHint: true.