Read Code
read_codeRead a known symbol or file from the user's project without dumping the whole tree. AST extract — signature plus body — cheaper than opening a 2,000-line file. ALWAYS call when find_code just returned a name or path, when the user named a function to inspect, or before you edit a large file. If they named Zephex or MCP and asked you to open or explain a function, this is the tool. Prefer this over native Read on files over ~50 lines. mode=symbol — extract by name (target or targets[]). mode=file — batch 1–20 paths. mode=outline — table of contents + plain-English overview before drilling a 300+ line file. mode=scan/smell — keywords or bug smells across files[] you already have. Works on any local project on their machine. Local/stdio: omit path to use editor cwd, or pass path as their project folder. No disk: inline_files. Call-graph modes (callers, blast_radius, dead_code) need local disk only. Returns summary, data.symbols or data.files, next_calls. Follow next_calls if truncated. Not for unknown location (find_code first). Not for stack/scripts (get_project_context). Example: read_code({ mode: "symbol", target: "validateToken" }) or read_code({ mode: "outline", files: ["src/auth.ts"] }). After find_code, do not re-search — pass the symbol as target or the path in files[]. detail_level=signature is enough to decide; body when you will edit. compact:true drops line numbers. Batch files[] instead of opening one path at a time.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | With mode:symbol. Filter to one symbol kind — disambiguate class vs method with same name. | |
| mode | No | symbol=AST extract by name (default). file=batch read files[] (all paths return). outline=file TOC. scan=keyword/pattern hits across files[] (use target or targets). smell=bug-pattern pass on files[] (empty catch, TODO, secrets). callers|blast_radius|dead_code=call graph (local path only). | |
| path | No | The user's project folder. Local/stdio: omit to use editor cwd, or pass the absolute folder. Hosted with no disk: use inline_files. Pair files[] from find_code. | |
| files | No | With mode:file|outline. Relative paths — from find_code hits. File mode: every path returns in one call (truncated per file if large, never dropped). | |
| target | No | mode:symbol|callers|blast_radius — symbol name (fuzzy). mode:scan — keyword or regex to find across files[]. | |
| compact | No | With mode:file|symbol. true = omit line numbers to save tokens. | |
| targets | No | mode:symbol — batch symbol names (max 8, set max_results:10). mode:scan — multiple keywords in one pass across files[]. | |
| symbol_id | No | With mode:symbol. Direct lookup ID from a prior hit (e.g. src/auth.ts::validateUser#function). Skips fuzzy search. | |
| max_tokens | No | Response size cap (default 2000, max 8000). File batch auto-shares across paths. Lower only if context is tight. | |
| session_id | No | Dedup across turns — symbols already returned get a stub with symbol_id instead of full body. | |
| limit_lines | No | With mode:file. Max lines per file. Default: budget-based; set for pagination slices. | |
| max_results | No | mode:symbol — max symbols (default 3, max 10). mode:scan|smell — max hits returned (default 30, max 100). | |
| offset_line | No | With mode:file. Start line (1-indexed). Use after batch read when data.hint says truncated. | |
| context_path | No | With mode:symbol. File path hint for ranking (e.g. src/auth.ts when repo has many auth symbols). | |
| detail_level | No | With mode:symbol. signature=~100 tokens. body=full implementation (default). context=body+imports. | |
| inline_files | No | When path disk is unavailable: {"src/auth.ts": ""}. Hosted/private transport fallback. | |
| confidence_threshold | No | With mode:symbol. Min match confidence 0–1 (default 0.5). Raise 0.8 for exact; lower 0.3 to explore. |