Skip to main content
Glama
GeminiDesk MCP
by LZ7TOP

Read File

fs_read_file

Read file contents with optional line-range selection, precise line numbers for code review, or base64 encoding for binary data.

Instructions

读取文件内容,支持按行分段读取、附加精确行号(withLineNumbers=true)或 base64 读取。

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": {
      "path": "<path>"
    },
    "name": "fs_read_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes目标文件路径
endLineNo结束行号(1-based,仅 utf8 模式有效)
encodingNo读取编码utf8
startLineNo起始行号(1-based,仅 utf8 模式有效)
withLineNumbersNo是否在每行前附带精确 1-based 行号(AI 看代码推荐开启)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full disclosure burden. It does not say whether reads are safe/non-mutating (implied), how large files are handled, what happens if the file is missing, or how startLine/endLine interact with base64 mode beyond the schema note. It repeats the line-number option that the schema already describes.

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?

A single compact sentence, front-loaded with the core purpose and then the optional modes. No wasted wording, though the parenthetical syntax is slightly dense.

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

Completeness2/5

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

For a 5-parameter read tool with no annotations and no output schema, the description should explain return shape expectations, error behavior, and the interaction between line ranges and encoding. None of that is present.

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 coverage is 100%, so all five parameters are already documented in the schema. The description adds essentially nothing beyond restating withLineNumbers and base64 mode; baseline 3 applies.

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+resource: reads file content, and names the supported modes (segment by line, line numbers, base64). It distinguishes itself via the modes but does not explicitly differentiate from sibling fs_read_lines/fs_read_tail/fs_batch_read.

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

Usage Guidelines2/5

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

No when-to-use vs when-not-to-use guidance. With siblings like fs_read_lines, fs_read_tail, and fs_batch_read existing, the agent gets no routing rule for which reader to pick; the mention of line-segment support hints at overlap but never resolves it.

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