read_body
Retrieve exact source code of a function or method by name or node ID, with line numbers and truncation handling. Get precise spans directly from byte offsets to avoid fallback reads.
Instructions
Read a function/method's real source (L3) — the 'open this and read it' move, so an agent never falls back to cat. Accepts a name or a node_id; returns the exact source span from byte offsets plus {node_id, name, file, start_line, end_line}, capped at max_chars (default 4000) with a truncated flag. If the file/offsets are unavailable it reconstructs a best-effort body from the function's L3 body nodes in line order.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| format | No | text (compact, default) | json (structured result page) | |
| node_id | No | ||
| max_chars | No |