Skip to main content
Glama
wonderwhy-er

Claude Desktop Commander MCP

read_file

Retrieve file contents from the file system or a URL with optional offset and length for partial reading. Supports text and image files, optimizes large file handling, and ensures secure directory access. Use absolute paths for reliability.

Instructions

                    Read the contents of a file from the file system or a URL with optional offset and length parameters.
                    
                    Prefer this over 'execute_command' with cat/type for viewing files.
                    
                    Supports partial file reading with:
                    - 'offset' (start line, default: 0)
                      * Positive: Start from line N (0-based indexing)
                      * Negative: Read last N lines from end (tail behavior)
                    - 'length' (max lines to read, default: configurable via 'fileReadLineLimit' setting, initially 1000)
                      * Used with positive offsets for range reading
                      * Ignored when offset is negative (reads all requested tail lines)
                    
                    Examples:
                    - offset: 0, length: 10     → First 10 lines
                    - offset: 100, length: 5    → Lines 100-104
                    - offset: -20               → Last 20 lines  
                    - offset: -5, length: 10    → Last 5 lines (length ignored)
                    
                    Performance optimizations:
                    - Large files with negative offsets use reverse reading for efficiency
                    - Large files with deep positive offsets use byte estimation
                    - Small files use fast readline streaming
                    
                    When reading from the file system, only works within allowed directories.
                    Can fetch content from URLs when isUrl parameter is set to true
                    (URLs are always read in full regardless of offset/length).
                    
                    Handles text files normally and image files are returned as viewable images.
                    Recognized image types: PNG, JPEG, GIF, WebP.
                    
                    IMPORTANT: Always use absolute paths for reliability. Paths are automatically normalized regardless of slash direction. Relative paths may fail as they depend on the current working directory. Tilde paths (~/...) might not work in all contexts. Unless the user explicitly asks for relative paths, use absolute paths.
                    This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
isUrlNo
lengthNo
offsetNo
pathYes
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure and does so comprehensively. It details performance optimizations (reverse reading, byte estimation, streaming), constraints (allowed directories, URL reading limitations), file type handling (text vs images), path requirements (absolute vs relative), and operational specifics like how offset/length parameters interact. This provides rich behavioral context beyond basic functionality.

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?

The description is well-structured with clear sections (purpose, preference guidance, parameter details, examples, performance, constraints, file handling, path instructions). While comprehensive, some sentences could be more concise (e.g., the final paragraph about referencing could be trimmed). However, most content earns its place by providing essential operational context.

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?

Given the complexity of the tool (4 parameters, no annotations, no output schema), the description is remarkably complete. It covers purpose, usage guidelines, parameter semantics, behavioral traits, performance characteristics, constraints, file type handling, and practical implementation details. For a read operation with rich parameter interactions, this provides sufficient context for an agent to use the tool correctly.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing detailed semantics for all parameters. It explains 'offset' with positive/negative behavior and 0-based indexing, 'length' with default values and interaction rules, 'path' with absolute path requirements, and 'isUrl' with URL-specific behavior. The examples concretely illustrate parameter usage, adding significant value beyond the bare schema.

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?

The description explicitly states the tool's purpose: 'Read the contents of a file from the file system or a URL with optional offset and length parameters.' It distinguishes from sibling tools like 'read_multiple_files' by focusing on single-file reading and from 'execute_command' by recommending preference over cat/type commands. The verb+resource combination is specific and clear.

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?

The description provides explicit guidance on when to use this tool: 'Prefer this over 'execute_command' with cat/type for viewing files.' It also mentions when not to use it (for relative paths unless explicitly requested) and distinguishes it from sibling tools like 'read_multiple_files' by focusing on single-file operations. The context of file system vs URL reading is clearly delineated.

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

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wonderwhy-er/DesktopCommanderMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server