Skip to main content
Glama

smart_read_file

Reads source files as AST skeletons, keeping the target function or class body and 1-hop dependency signatures while folding inert code to reduce token usage. Use symbol for schema files.

Instructions

AST-skeleton file reader: keeps the target function/class body + 1-line 1-hop dependency signatures, folds inert code (-90-99% tokens). Relative or absolute paths. Schema files (OpenAPI/Prisma/GraphQL/SQL) auto-slice via 'symbol'. For 3+ related symbols use smart_bundle instead.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "smart_read_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesFile path (relative to workspace or absolute)
symbolNoOptional: function/method/class/component or schema model/type/table to extract (omit for whole-file skeleton)
dep_modeNo'signature' (default) = 1-line dep signatures; 'full' = inline dependency bodies
end_lineNoOptional: ending line number
force_fullNoBypass pointer dedup — use only after context compaction or as a fresh subagent
start_lineNoOptional: starting line number
include_depsNoInclude 1-hop dependency signatures (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv3.1.5
    • changedInput schema / properties / dep_mode / description
      Previous value: -"Optional: how 1-hop dependencies are returned when include_deps is true. 'signature' (default, -95%+ tokens) returns compact 1-line signatures; 'full' inlines full dependency bodies."New value: +"'signature' (default) = 1-line dep signatures; 'full' = inline dependency bodies"
    • changedInput schema / properties / force_full / description
      Previous value: -"Optional: bypass session pointer deduplication and return the full skeleton directly (use only if your context was compacted or you are a fresh subagent lacking earlier reads)."New value: +"Bypass pointer dedup — use only after context compaction or as a fresh subagent"
    • changedInput schema / properties / include_deps / description
      Previous value: -"Optional: whether to include 1-hop dependencies (default: true). Set false for 0-hop surgical isolation."New value: +"Include 1-hop dependency signatures (default true)"
    • changedInput schema / properties / path / description
      Previous value: -"File path to read (relative to workspace or absolute, e.g. './src/index.ts')"New value: +"File path (relative to workspace or absolute)"
    • changedInput schema / properties / symbol / description
      Previous value: -"Optional: targeted function, method, class, component, or schema model/type to extract with 1-hop dependencies while folding surrounding code (omit for whole-file AST skeleton or schema overview)"New value: +"Optional: function/method/class/component or schema model/type/table to extract (omit for whole-file skeleton)"
  2. First observedv2.8.4

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, so the description carries the full burden, and it does a lot: it discloses the token-folding ratio (-90-99%), the AST-skeleton return shape, 1-hop dependency inlining, pointer dedup behavior, and the caching-sensitive caveat for force_full. It never states error behavior for missing paths or encoding/large-file limits, which keeps it off a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded and dense: the core mechanism comes first, then path handling, then schema slicing, then sibling routing. Telegraphic fragments (

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter read tool with no annotations and no output schema, the definition covers mechanism, return shape, defaults, and one escalation path, which is close to sufficient. Missing are failure modes and a pointer to what an agent should do when a symbol name is ambiguous or not found.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so every parameter is already documented, and the description largely restates it (relative/absolute paths, symbol-based extraction, force_full's compaction caveat). The only genuine addition is which schema dialects auto-slice (OpenAPI/Prisma/GraphQL/SQL). Hence the baseline 3 rather than higher.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb+resource ('AST-skeleton file reader') plus exactly what is preserved (target function/class body, 1-hop dependency signatures) and what is folded away. It names the sibling to use for a different case, so an agent can distinguish this from smart_bundle without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear routing rule away from a sibling ('For 3+ related symbols use smart_bundle instead') and a guard on force_full ('use only after context compaction or as a fresh subagent'). Also notes that schema files should be sliced via 'symbol'. It lacks explicit guidance on when to read a whole file versus a slice, or when to prefer scoped_search/list_dir, so it stops short of full when/when-not coverage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.