read_for_edit
Get exact raw code around a symbol or line to copy as old_string for the Edit tool. Supports batch retrieval of multiple symbols.
Instructions
Use INSTEAD OF Read when preparing an EDIT. Returns exact RAW code around a symbol or line — copy directly as old_string for Edit tool. Supports batch: pass "symbols" array to get multiple edit contexts in one call. Unlike read_symbols (for reading/understanding), this returns unformatted code optimized for copy-paste into Edit. Optional: include_callers, include_tests, include_changes for enriched context.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path | |
| symbol | No | Symbol name to edit (e.g. "UserService.updateUser") | |
| symbols | No | Array of symbol names for batch edit context (max 10). Alternative to single "symbol" — returns all symbols in one call. | |
| line | No | Line number to edit (alternative to symbol) | |
| context | No | Lines of context around target (default: 5) | |
| include_callers | No | Show top callers of this symbol (saves a separate find_usages call) | |
| include_tests | No | Show related test file and test names | |
| include_changes | No | Show recent git changes in the target region | |
| section | No | Section to edit: heading (Markdown), top-level key (YAML/JSON), or "rows:1-50" (CSV). Returns raw section content for Edit old_string. |