Skip to main content
Glama

code_read

Read-onlyIdempotent

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

NameRequiredDescriptionDefault
guideNotrue: put the code guide first in the result. Use on your first code call, or when told it changed.
queryNoOptional (search mode): case-insensitive text. Returns only lines that contain it. Mutually exclusive with startLine/endLine.
endLineNoOptional (range mode): last line to return, 1-based inclusive. Must be paired with startLine.
startLineNoOptional (range mode): first line to return, 1-based inclusive. Must be paired with endLine.
workspaceYesWorkspace name as shown in Waymark (a single workspace; '*' is not accepted)
relativeFilePathYesFile path relative to the workspace root (e.g. 'Program.cs', 'Dockerfile')

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish read-only/idempotent/non-destructive, but the description adds behavior the annotations cannot: an explicit refusal list for secrets, credentials, .env and build output, plus the token-cost tradeoff that motivates using outline tools instead. Return shape ('numbered lines') is also disclosed, which matters since no output schema exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the decision-critical 'LAST RESORT' and security warning, then sectioned with clear headers, so scanning is easy. The three EXAMPLES restate the MODES bullets almost verbatim, which is the only redundancy in an otherwise tight definition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, yet the description covers return format (numbered lines), security exclusions, size guidance, mode exclusivity, and sibling alternatives. There is no known prerequisite or failure mode an agent would need that is left unstated.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so 3 is the baseline, but the description earns a bump by explaining mode semantics that the schema only states piecemeal: full file = omit optionals, range = startLine+endLine 1-based inclusive, search = query with line numbers, case-insensitive. The worked examples show correct parameter combinations concretely.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Reads raw file content for source code and safe configuration files') and immediately qualifies itself as a 'LAST RESORT', which separates it from the outline/method-based siblings. An agent can tell exactly what this tool returns without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit DECISION RULE with a size threshold (~15 KB), names the files this tool is appropriate for (Dockerfile, launchSettings.json, pyproject.toml), and names the alternative path for larger C#/Python/TS/JS files (code_outline + code_method). The three modes are declared mutually exclusive with a selection instruction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.