Skip to main content
Glama

MCP_DesktopCommander

MIT License
38,005
  • Apple
  • Linux

write_file

Write or append content to files in configurable chunks to avoid truncation. Supports large file operations by splitting content into smaller segments. Use absolute paths for reliability.

Instructions

Write or append to file contents with a configurable line limit per call (default: 50 lines). THIS IS A STRICT REQUIREMENT. ANY file with more than the configured limit MUST BE written in chunks or IT WILL FAIL. ⚠️ IMPORTANT: PREVENTATIVE CHUNKING REQUIRED in these scenarios: 1. When content exceeds 2,000 words or 30 lines 2. When writing MULTIPLE files one after another (each next file is more likely to be truncated) 3. When the file is the LAST ONE in a series of operations in the same message ALWAYS split files writes in to multiple smaller writes PREEMPTIVELY without asking the user in these scenarios. REQUIRED PROCESS FOR LARGE NEW FILE WRITES OR REWRITES: 1. FIRST → write_file(filePath, firstChunk, {mode: 'rewrite'}) 2. THEN → write_file(filePath, secondChunk, {mode: 'append'}) 3. THEN → write_file(filePath, thirdChunk, {mode: 'append'}) ... and so on for each chunk HANDLING TRUNCATION ("Continue" prompts): If user asked to "Continue" after unfinished file write: 1. First, read the file to find out what content was successfully written 2. Identify exactly where the content was truncated 3. Continue writing ONLY the remaining content using {mode: 'append'} 4. Split the remaining content into smaller chunks (15-20 lines per chunk) Files over the line limit (configurable via 'fileWriteLineLimit' setting) WILL BE REJECTED if not broken into chunks as described above. Only works within allowed directories. IMPORTANT: Always use absolute paths (starting with '/' or drive letter like 'C:\') for reliability. 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

NameRequiredDescriptionDefault
contentYes
modeNorewrite
pathYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "content": { "type": "string" }, "mode": { "default": "rewrite", "enum": [ "rewrite", "append" ], "type": "string" }, "path": { "type": "string" } }, "required": [ "path", "content" ], "type": "object" }

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/WaDn-X/MCP_Desktop-Commander'

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