smart_read
Replace full file reads with structural summaries: retrieve classes, functions, methods with signatures and line ranges, using 60-80% fewer tokens. Drill into specific symbols as needed.
Instructions
Use INSTEAD OF Read/cat for code files. Returns code structure (classes, functions, methods with signatures and line ranges) — 60-80% fewer tokens than raw content. Use read_symbol() to drill into specific code.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path (absolute or relative to project root) | |
| show_imports | No | Include import details (default: true) | |
| show_docs | No | Include doc comments (default: true) | |
| depth | No | Max depth for nested symbols (default: 2) | |
| scope | No | Output scope: full (default, all details), nav (names + lines only, 2-3x smaller), exports (public API only) | |
| max_tokens | No | Token budget. If output exceeds this, auto-downgrades: full → outline → compact. Use for context-constrained sessions. | |
| session_id | No | Optional Claude Code session_id. When provided, dedup state (already-loaded files) persists across MCP server restarts and /clear, tied to that session. Omit to use ephemeral process-scoped dedup. | |
| force | No | Bypass dedup — return full content even if the same path was already loaded earlier in this session. Use when the prior result was compacted out of context. |