Skip to content
context-engine
Tools

line_context

Read meaningful source context around exact file and line locations.

Use line_context for diagnostics, logs, search hits, stack traces, or user-provided file:line references when you need the containing source items and parent hierarchy.

Use when

  • You know exact files and 1-based lines but not the containing symbol.
  • You need context around up to 32 related locations.

Do not use when

  • You already know an exact range; use smart_read.
  • You need to resolve a visible identifier; use jump.

Request

{"locations":[{"file":"/workspace/project/src/lib.rs","line":42}],"include_docs":false,"output_mode":"type_annotated","workspace_root":"/workspace/project"}

Parameters

FieldRequiredDefault / bounds
locationsyes1–32 entries; each line is a 1-based integer ≥ 1.
locations[].fileyesNon-empty path (file_path is not the nested field name).
include_docsnofalse.
output_modenotype_annotated; union: type_annotated, plain_text, both.
workspace_rootnoActive workspace routing.

What it returns

Complete meaningful source items or document sections containing each location, including parent hierarchy. Type-annotated output falls back to plain text with a per-range note when inlay hints are unavailable.

Common mistakes

  • Sending zero-based lines or quoting the line number.
  • Sending more than 32 locations in one request.
  • Enabling include_docs when documentation is not needed.

smart_read, jump, hover, outline