extract_code_block
Extract full functions, structs, classes, or methods from a file with exact line ranges and content, including annotations, using bracket matching that ignores braces in strings and comments.
Instructions
Read the full text of a function, struct, class, or method from a file. Returns precise line range + content. Includes leading annotations (#[derive], @decorator, /// doc comments). String/comment-aware bracket matching prevents false depth counts from braces inside strings or comments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory for resolving relative file paths (default: primary project root) | |
| file | Yes | Source file path (absolute or relative to cwd) | |
| symbol | Yes | Symbol name to extract | |
| contextLines | No | Extra lines before/after the block (default: 0) |