Skip to main content
Glama
wonderwhy-er

Claude Desktop Commander MCP

write_file

Destructive

Write or append content to files, supporting text, Excel, and DOCX formats. Use absolute paths and chunk content into 25-30 line segments for reliable writes.

Instructions

                    Write or append to file contents.

                    IMPORTANT: DO NOT use this tool to create PDF files. Use 'write_pdf' for all PDF creation tasks.
                    DO NOT use this tool to edit DOCX files. Use 'edit_block' with old_string/new_string instead.
                    To CREATE a new DOCX, use write_file with .docx extension — text content with markdown headings (#, ##, ###) is converted to styled DOCX paragraphs.

                    CHUNKING IS STANDARD PRACTICE: Always write files in chunks of 25-30 lines maximum.
                    This is the normal, recommended way to write files - not an emergency measure.

                    STANDARD PROCESS FOR ANY FILE:
                    1. FIRST → write_file(filePath, firstChunk, {mode: 'rewrite'})  [≤30 lines]
                    2. THEN → write_file(filePath, secondChunk, {mode: 'append'})   [≤30 lines]
                    3. CONTINUE → write_file(filePath, nextChunk, {mode: 'append'}) [≤30 lines]

                    ALWAYS CHUNK PROACTIVELY - don't wait for performance warnings!

                    WHEN TO CHUNK (always be proactive):
                    1. Any file expected to be longer than 25-30 lines
                    2. When writing multiple files in sequence
                    3. When creating documentation, code files, or configuration files

                    HANDLING CONTINUATION ("Continue" prompts):
                    If user asks to "Continue" after an incomplete operation:
                    1. Read the file to see what was successfully written
                    2. Continue writing ONLY the remaining content using {mode: 'append'}
                    3. Keep chunks to 25-30 lines each

                    FORMAT HANDLING (by extension):
                    - Text files: String content
                    - Excel (.xlsx, .xls, .xlsm): JSON 2D array or {"SheetName": [[...]]}
                      Example: '[["Name","Age"],["Alice",30]]'

                    Files over 50 lines will generate performance notes but are still written successfully.
                    Only works within allowed directories.

                    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
pathYes
contentYes
modeNorewrite
Behavior5/5

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

Annotations already indicate destructiveHint=true, but the description adds critical behavioral details: chunking is standard practice, path normalization to absolute paths, allowed directories, performance notes for files over 50 lines, and continuation handling. No contradictions with annotations.

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

Conciseness3/5

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

The description is thorough but verbose, containing repeated instructions about chunking and continuation. It is well-structured with headings and bullet points, but could be more terse without losing clarity. Adequate but not optimal in conciseness.

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 tool's complexity (modes, file type handling, chunking, performance notes) and the absence of an output schema, the description covers all essential aspects for correct agent usage: formatting, continuation, path handling, and allowed directories. It is complete and actionable.

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?

Schema has 0% description coverage, but the description compensates fully: it explains the 'mode' enum (rewrite vs append), specifies that 'content' is the file contents, and mandates absolute paths for 'path' along with normalization behavior. This adds significant value beyond the 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 clearly states 'Write or append to file contents' and explicitly distinguishes from sibling tools: 'DO NOT use this tool to create PDF files. Use write_pdf... DO NOT use this tool to edit DOCX files. Use edit_block...' It also explains handling for DOCX creation, making the purpose highly specific.

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 when-to-use and when-not-to-use guidance, including alternatives (write_pdf, edit_block) and a detailed step-by-step chunking process ('ALWAYS CHUNK PROACTIVELY'). It also covers continuation handling and format-specific instructions.

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

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