Fetch Source Code Snippets by Line Range
fetch_code_snippetsReads exact source code line ranges from workspace files for graph nodes or file coordinates, returning YAML snippets and per-item errors without failing the batch.
Instructions
Read exact source code line ranges from workspace files on disk for a batch of graph nodes or file coordinates passed as a YAML list. Use when inspecting implementation bodies of symbols discovered via find_symbol, get_callers, or execute_custom_read_cypher; to view a file's structural symbol list without reading source text use get_file_outline. Resolves each item's file_path relative to workspacePath, clamps start_line..end_line to valid file bounds (recording per-item errors if a file is missing without failing the batch), and returns YAML snippets in input order.
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": {
"nodes": "<nodes>"
},
"name": "fetch_code_snippets"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodes | Yes | Required YAML list of snippet request objects, each specifying 'file_path' (workspace-relative or absolute path), 'start_line' (1-based inclusive start line), and 'end_line' (1-based inclusive end line). | |
| workspacePath | No | Optional absolute path to the target workspace root directory. Omit to use the bound workspace, active client root, or sticky session workspace. |