Skip to content
context-engine
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_context or outline.
  • 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

FieldRequiredDefault / bounds
fileyesPath (file_path is accepted as an alias).
linesno[] reads the complete file (reserve for small files); each start ≥ 1.
lines[].endnoOmitted means through end of file; ranges are 1-based and inclusive.
output_modenotype_annotated; union: type_annotated, plain_text, both.
workspace_rootnoActive 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 end unintentionally on a large file.
  • Reading an entire file when outline plus extract would be more targeted.

line_context, outline, extract