Skip to main content
Glama

read

Retrieves file text with line numbers or raster images, detects common encodings, pages large content via offset/limit, and reports truncation and next offset.

Instructions

Read text with line numbers or return raster images as ImageContent. Detects common encodings; SVG stays text. Text is bounded and reports truncation/next_offset. Use offset/limit to page; relative paths use the workspace or MCP root.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "read"
  }
}

Input Schema

NameRequiredDescriptionDefault
allNoDisable line cap; character cap remains
pathNoAlias for file_path
limitNoLine limit; default 400. Use 0 or all=true for no line cap
offsetNoStart line: 1-based integer, negative from end, 'start-end', or [start,end]; default 1
encodingNoCharset override, e.g. EUC-KR or Shift_JIS; overrides .editorconfig, BOM takes priority
end_lineNoInclusive end with start_line
file_pathNoWorkspace-relative, absolute, or @name/subpath (directory_alias)
start_lineNoAlias for offset
include_hashNoInclude SHA-256; default true
max_line_charsNoPer-line character cap; default 4000, max 32768
max_output_charsNoOutput character cap; default 32768, min 256, max 131072

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.1.2
    • changedInput schema / properties / file_path / description
      Previous value: -"Absolute or workspace/MCP-root-relative file path"New value: +"Workspace-relative, absolute, or @name/subpath (directory_alias)"
  2. Changed2 schema fields changedv1.0.5
    • addedInput schema / properties / encoding
      Added value: +{
      +  "description": "Charset override, e.g. EUC-KR or Shift_JIS; overrides .editorconfig, BOM takes priority",
      +  "type": "string"
      +}
    • changedInput schema / properties / max_output_chars / description
      Previous value: -"Output character cap; default 32768, max 131072"New value: +"Output character cap; default 32768, min 256, max 131072"
  3. Changed11 schema fields changedv0.9.7
    • changedInput schema / properties / all / description
      Previous value: -"Remove the default line limit. The max_output_chars safety budget still applies. Default: false"New value: +"Disable line cap; character cap remains"
    • changedInput schema / properties / end_line / description
      Previous value: -"Inclusive end line used with start_line"New value: +"Inclusive end with start_line"
    • changedInput schema / properties / file_path / description
      Previous value: -"Absolute or workspace-relative path to the file to read"New value: +"Absolute or workspace/MCP-root-relative file path"
    • changedInput schema / properties / include_hash / description
      Previous value: -"Include SHA-256 for optimistic edit concurrency. Default: true"New value: +"Include SHA-256; default true"
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum lines to return. Default: 400. Set 0 or all=true to remove the line limit; the character budget still applies"New value: +"Line limit; default 400. Use 0 or all=true for no line cap"
    • changedInput schema / properties / max_line_chars / description
      Previous value: -"Maximum characters returned from one line. Default: 4000, Max: 32768"New value: +"Per-line character cap; default 4000, max 32768"
    • changedInput schema / properties / max_output_chars / description
      Previous value: -"Maximum returned text characters. Default: 32768, Max: 131072"New value: +"Output character cap; default 32768, max 131072"
    • changedInput schema / properties / offset / description
      Previous value: -"Line offset. Integer (1-based, negative=from end), string range 'start-end', or [start,end] array. Default: 1"New value: +"Start line: 1-based integer, negative from end, 'start-end', or [start,end]; default 1"
    • addedInput schema / properties / offset / type
      Added value: +"integer"
    • changedInput schema / properties / path / description
      Previous value: -"Compatibility alias for file_path; prefer file_path"New value: +"Alias for file_path"
    • changedInput schema / properties / start_line / description
      Previous value: -"Compatibility alias for offset; prefer offset"New value: +"Alias for offset"
  4. Changed13 schema fields changedv0.9.5
    • addedInput schema / properties / all
      Added value: +{
      +  "description": "Remove the default line limit. The max_output_chars safety budget still applies. Default: false",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / end_line / description
      Previous value: -"End line number (1-based, inclusive). Sets limit = end_line - start_line + 1 when used with start_line"New value: +"Inclusive end line used with start_line"
    • addedInput schema / properties / end_line / type
      Added value: +[
      +  "null",
      +  "integer"
      +]
    • changedInput schema / properties / file_path / description
      Previous value: -"Absolute or relative path to the file to read"New value: +"Absolute or workspace-relative path to the file to read"
    • addedInput schema / properties / include_hash
      Added value: +{
      +  "description": "Include SHA-256 for optimistic edit concurrency. Default: true",
      +  "type": [
      +    "null",
      +    "boolean"
      +  ]
      +}
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum number of lines to read. Default: 0 (all)"New value: +"Maximum lines to return. Default: 400. Set 0 or all=true to remove the line limit; the character budget still applies"
    • addedInput schema / properties / limit / type
      Added value: +[
      +  "null",
      +  "integer"
      +]
    • addedInput schema / properties / max_line_chars
      Added value: +{
      +  "description": "Maximum characters returned from one line. Default: 4000, Max: 32768",
      +  "type": "integer"
      +}
    • addedInput schema / properties / max_output_chars
      Added value: +{
      +  "description": "Maximum returned text characters. Default: 32768, Max: 131072",
      +  "type": "integer"
      +}
    • changedInput schema / properties / offset / description
      Previous value: -"Line offset. Integer (1-based, negative=from end), string range 'start-end', or [start,end] array. Default: 0 (all)"New value: +"Line offset. Integer (1-based, negative=from end), string range 'start-end', or [start,end] array. Default: 1"
    • changedInput schema / properties / path / description
      Previous value: -"Alias for file_path"New value: +"Compatibility alias for file_path; prefer file_path"
    • changedInput schema / properties / start_line / description
      Previous value: -"Alias for offset (1-based line number to start reading from)"New value: +"Compatibility alias for offset; prefer offset"
    • addedInput schema / properties / start_line / type
      Added value: +[
      +  "null",
      +  "integer"
      +]
  5. Addedv0.8.7
  6. Removed
  7. Changed3 schema fields changedv0.7.12
    • changedInput schema / properties / offset / description
      Previous value: -"Line number to start reading from (1-based). Negative = from end (e.g. -5 = last 5 lines). Default: 1"New value: +"Line offset. Integer (1-based, negative=from end), string range 'start-end', or [start,end] array. Default: 0 (all)"
    • removedInput schema / properties / offset / type
      Removed value: -"integer"
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": false,
      -  "properties": {
      -    "content": {
      -      "type": "string"
      -    },
      -    "encoding": {
      -      "type": "string"
      -    },
      -    "hash": {
      -      "type": "string"
      -    },
      -    "total_lines": {
      -      "type": "integer"
      -    }
      -  },
      -  "required": [
      -    "content",
      -    "encoding",
      -    "total_lines"
      -  ],
      -  "type": "object"
      -}New value: +null
  8. First observedv0.4.2

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does disclose real behavior: encoding auto-detection with SVG kept as text, bounded output with truncation and next_offset reporting, and default caps. It stops short of stating side effects or permission requirements, though a read operation makes those largely moot.

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?

Four tight sentences with the core behavior front-loaded and no filler. The compression is heavy in places ("Detects common encodings; SVG stays text"), but each sentence contributes information.

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

Completeness4/5

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

For an 11-parameter tool with no output schema and no annotations, the description covers output shape, truncation signaling, encoding behavior, and path resolution. Remaining gaps (hash inclusion, line-character caps) are documented in the schema, so an agent can call it correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already defines all 11 parameters including aliases and defaults. The description adds meaning for offset/limit as paging controls and for relative path resolution, but leaves parameters such as all, include_hash, and max_line_chars to the schema.

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

Purpose4/5

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

States a specific verb and resource: reading text with line numbers or returning raster images as ImageContent, and explicitly notes that SVG stays text rather than becoming an image. It does not name the sibling it complements (e.g., multiread for multiple files), so differentiation is implied rather than stated.

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

Usage Guidelines3/5

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

Gives a concrete usage rule for paging ("Use offset/limit to page") and states how relative paths resolve to the workspace or MCP root. There is no explicit when-not guidance or reference to an alternative tool for multi-file or binary cases, so guidance is present but incomplete.

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