code_read
Reads raw source and safe configuration files, with line-range and search modes, for small files or formats that code tools cannot outline; refuses sensitive files and build output.
Instructions
LAST RESORT: Reads raw file content for source code and safe configuration files. SECURITY: sensitive files (appsettings*.json, secrets, credentials, keys, .env, database files) and build output are refused. DECISION RULE: use ONLY for files of about 15 KB or less, or for files the code tools cannot outline (Dockerfile, launchSettings.json, project files, pyproject.toml, .razor). For larger C#, Python, TypeScript or JavaScript files use code_outline + code_method instead (large token savings).
MODES (mutually exclusive, pick one):
Full file: omit all optional parameters
Line range: provide startLine + endLine to fetch a slice (1-based, inclusive)
Search: provide query to return all lines containing it, with line numbers (case-insensitive)
EXAMPLES: code_read(workspace, 'Program.cs') - full file code_read(workspace, 'Program.cs', startLine=10, endLine=40) - lines 10-40 only code_read(workspace, 'Program.cs', query='AddSingleton') - all lines containing 'AddSingleton'
RETURNS: numbered lines.
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": {
"workspace": "<workspace>",
"relativeFilePath": "<relativeFilePath>"
},
"name": "code_read"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guide | No | true: put the code guide first in the result. Use on your first code call, or when told it changed. | |
| query | No | Optional (search mode): case-insensitive text. Returns only lines that contain it. Mutually exclusive with startLine/endLine. | |
| endLine | No | Optional (range mode): last line to return, 1-based inclusive. Must be paired with startLine. | |
| startLine | No | Optional (range mode): first line to return, 1-based inclusive. Must be paired with endLine. | |
| workspace | Yes | Workspace name as shown in Waymark (a single workspace; '*' is not accepted) | |
| relativeFilePath | Yes | File path relative to the workspace root (e.g. 'Program.cs', 'Dockerfile') |