Tools
smart_read
Read exact inclusive line ranges from a known file.
Use smart_read when you know the exact 1-based inclusive ranges to inspect.
Use when
- A diagnostic or review identifies precise lines.
- You need a small set of ranges from one file.
Do not use when
- You need to discover containing symbols; use
line_contextoroutline. - You need a definition from a visible identifier; use
jump.
Request
{"file":"/workspace/project/src/lib.rs","lines":[{"start":40,"end":58}],"output_mode":"type_annotated","workspace_root":"/workspace/project"}Parameters
| Field | Required | Default / bounds |
|---|---|---|
file | yes | Path (file_path is accepted as an alias). |
lines | no | [] reads the complete file (reserve for small files); each start ≥ 1. |
lines[].end | no | Omitted means through end of file; ranges are 1-based and inclusive. |
output_mode | no | type_annotated; union: type_annotated, plain_text, both. |
workspace_root | no | Active workspace routing. |
What it returns
The requested file ranges. Type-annotated output uses resolved LSP inlay hints and falls back to plain text with a short per-range note when hints are unavailable.
Common mistakes
- Using zero-based or exclusive line numbers.
- Omitting
endunintentionally on a large file. - Reading an entire file when
outlineplusextractwould be more targeted.
Related tools
line_context, outline, extract