Skip to main content
Glama
wonderwhy-er

Claude Desktop Commander MCP

by wonderwhy-er

read_file

Read-only

Read contents from files and URLs. Read PDF files and extract content as markdown and images.

Instructions

                    Read contents from files and URLs.
                    Read PDF files and extract content as markdown and images.
                    
                    Suitable for reading authorized local files directly without starting a shell command.
                    
                    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).
                    
                    FORMAT HANDLING (by extension):
                    - Text: Uses offset/length for line-based pagination
                    - Excel (.xlsx, .xls, .xlsm): Returns JSON 2D array
                      * sheet: "Sheet1" (name) or "0" (index as string, 0-based)
                      * range uses FROM:TO format (e.g., "A1:D100", "C1:C1", "B2:B50")
                      * offset/length work as row pagination (optional fallback)
                    - Images (PNG, JPEG, GIF, WebP): Base64 encoded viewable content
                    - PDF: Extracts text content as markdown with page structure
                      * offset/length work as page pagination (0-based)
                      * Includes embedded images when available
                    - DOCX (.docx): Two modes depending on parameters:
                      * DEFAULT (no offset/length): Returns a text-bearing outline — shows paragraphs with text,
                        tables with cell content, styles, image refs. Skips shapes/drawings/SVG noise.
                        Each element shows its body index [0], [1], etc.
                      * WITH offset/length: Returns raw pretty-printed XML with line pagination.
                        Use this to drill into specific sections or see the actual XML for editing.
                      * Raw DOCX XML output is compatible with edit_block's XML find/replace mode using
                        XML fragments copied from the read output.
                      * Raw XML mode requires a non-zero offset (offset=1 starts from line 1).
                        offset=0 returns the outline regardless of length.
                      * Bulk transformations can be performed programmatically against the DOCX archive
                        when the task requires changes across many XML text nodes.

                    Absolute paths are the most reliable because they do not depend on the current working directory. Paths are automatically normalized regardless of slash direction. Relative paths depend on the current working directory, and tilde paths (~/...) may not resolve in every context. Absolute paths are generally the most reliable.
                    This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
isUrlNo
rangeNo
sheetNo
lengthNo
offsetNo
originNo
optionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.43
    • addedInput schema / properties / origin
      Added value: +{
      +  "enum": [
      +    "ui",
      +    "llm"
      +  ],
      +  "type": "string"
      +}
  2. Changed3 schema fields changedv0.2.17
    • addedInput schema / properties / options
      Added value: +{
      +  "additionalProperties": {},
      +  "type": "object"
      +}
    • addedInput schema / properties / range
      Added value: +{
      +  "type": "string"
      +}
    • addedInput schema / properties / sheet
      Added value: +{
      +  "type": "string"
      +}
  3. First observedv1.0.0

TDQS

A4.3/5.0
Behavior5/5

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

Beyond the readOnly/openWorld annotations, the description discloses a great deal: directory allow-listing, URL-is-read-in-full-regardless-of-pagination, reverse-read/byte-estimation performance behavior, per-format return shapes, and the DOCX mode switch keyed on offset/length. This is exactly the added context annotations cannot carry.

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 and well-organized with headers, bullets, and concrete examples that earn their space. It loses a point for redundancy: the 'absolute paths are the most reliable' point is stated twice in the closing paragraph, and the 'DC: ...' trailer is noise rather than specification.

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?

For a complex 8-parameter tool with no output schema, the description covers return shapes per format (JSON 2D array, base64, markdown, DOCX outline vs raw XML) and the pagination model thoroughly. An agent has everything it needs to invoke it correctly without a return-value schema.

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 0%, so the description carries the burden and largely succeeds: offset (including negative tail semantics and the length-ignored interaction), length, isUrl, sheet, and range are all explained with worked examples. It leaves 'origin' and the 'options' object undocumented, so it is not fully compensating for all 8 parameters.

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?

The opening line states a specific verb and resource: 'Read contents from files and URLs,' and the format-handling section makes the scope (text, Excel, images, PDF, DOCX) concrete. It does not name the obvious sibling read_multiple_files to distinguish when to pick one over the other, so it stops short of a 5.

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

Usage Guidelines4/5

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

It gives clear usage context: 'Suitable for reading authorized local files directly without starting a shell command,' plus the constraint that file reads 'only works within allowed directories' and that URLs require isUrl=true. However it never states when to prefer this over read_multiple_files or list_directory, so no explicit alternative routing.

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