Skip to main content
Glama

Edit site files

files_write
Destructive

Uploads files (text, base64 or URL), writes text files, creates folders, renames and moves items in the site file manager. Do not write files with secrets (.env, files with passwords or keys): the site owner uploads such a file (control panel or FTP), and the code loads it.

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": {
      "action": "<action>",
      "site_id": "<site_id>"
    },
    "name": "files_write"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNoupload_url: http:// or https:// URL that ends with a file name and extension.
fileNoupload: synonym for a single text body when files and content are omitted.
nameNoupload: saved name when the request has exactly one file. upload_url: saved name, or the last URL segment when omitted. rename: new leaf name (no slashes) for a single object.
pathNoClean path without edge slashes, passed as a parameter (never as a URL suffix). Empty string is the site root; content_get, content_put and mkdir need a non-empty path. Allowed bytes are A-Z a-z 0-9 . _ / -; segments cannot be empty, ".", "..", or start with a dot. Folder for list, info, upload, upload_url and move; file for content_get and content_put; new folder for mkdir; source for rename, move and delete.
sizeNoupload_direct: exact byte size of the file that will be POSTed to upload_url (1..16777216). The curl body must match it exactly. upload: expected byte size of the single top-level body after base64 decoding; a mismatch fails the call before anything is stored.
filesNoupload: one or more files. Each item is { filename, content } or { filename, content_base64 }. Sent as a repeated multipart field named file. name applies only when this list has one file and no extra top-level body.
itemsNorename batch: map of leaf name to new leaf name inside path. When this object is present the call always returns results per item, even if name is also set.
pathsNomove: sources to move; a non-empty list ignores path and always returns results per item. delete: targets, together with path. Items are clean paths.
actionYesOperation to run. Each oneOf entry describes one action and lists its parameters.
createNocontent_put: create the file when it does not exist. Default false. Parent folder must already exist.
sha256Noupload: expected SHA-256 hex of the single top-level body after base64 decoding; a mismatch fails the call before anything is stored.
contentNocontent_put: new file text (empty string is allowed). upload: text body of a single file when files is omitted.
site_idYesSite to change: site_id from list_sites. Required: the call works only on this site, whatever select_site chose.
filenameNoupload and upload_direct: original file name (multipart filename). Falls back to name.
add_wmarkNoupload and upload_url: apply the site watermark when it is enabled and the extension is an allowed image.
upload_idNoupload: id from upload_direct whose bytes were already POSTed. Saved into path under its upload_direct filename, or name when it is the only file. Spent only when that item is uploaded; otherwise it stays usable until it expires.
upload_idsNoupload: several upload_direct ids (a comma-separated string is accepted too), sent after upload_id and inline files. At most 20.
destinationNomove: existing destination folder. Empty string is the site root.
content_base64Noupload: standard base64 body of a single binary file when files is omitted. Inline base64 suits small files only: a long base64 body produced by a model arrives truncated. Foreign characters or a truncated length fail the call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / site_id
      Added value: +{
      +  "description": "Site to change: site_id from list_sites. Required: the call works only on this site, whatever select_site chose.",
      +  "type": "integer"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "action"
      -]New value: +[
      +  "action",
      +  "site_id"
      +]
  2. Changed1 schema field changed
    • changedInput schema / properties / action / oneOf
      Previous value: -[
      -  {
      -    "const": "content_put",
      -    "description": "Writes text into a file. Required: path, content. Optional: create."
      -  },
      -  {
      -    "const": "upload",
      -    "description": "Uploads one or more files into the folder path. Bytes come from files, content, content_base64, file, upload_id and upload_ids. Pass size and sha256 with inline bodies; a successful upload returns sent with both. Returns per-item results. Optional: path, files, content, content_base64, file, filename, name, size, sha256, upload_id, upload_ids, add_wmark."
      -  },
      -  {
      -    "const": "upload_url",
      -    "description": "Downloads a file from a public URL into the folder path. Returns per-item results. Required: url. Optional: path, name, add_wmark."
      -  },
      -  {
      -    "const": "upload_direct",
      -    "description": "Creates a one-time upload URL for a file of the given name and exact size, so binary files never pass through the model context. POST the raw bytes to the returned upload_url (for example with curl); the response is upload_id, filename, size and sha256. Pass upload_id to upload (with path), or as *_upload_id to the content and shop write tools. Required: filename, size."
      -  },
      -  {
      -    "const": "mkdir",
      -    "description": "Creates a folder. Required: path."
      -  },
      -  {
      -    "const": "rename",
      -    "description": "Renames one item (path and name) or several items in the folder path (items). Batch form returns per-item results. Required: path. Optional: name, items."
      -  },
      -  {
      -    "const": "move",
      -    "description": "Moves path, or every item of paths, into destination. The paths form returns per-item results. Required: destination. Optional: path, paths."
      -  }
      -]New value: +[
      +  {
      +    "const": "content_put",
      +    "description": "Writes text into a file. Required: path, content. Optional: create."
      +  },
      +  {
      +    "const": "upload",
      +    "description": "Uploads one or more files into the folder path. Bytes come from files, content, content_base64, file, upload_id and upload_ids. Pass size and sha256 with inline bodies; a successful upload returns sent with both. Returns per-item results. Optional: path, files, content, content_base64, file, filename, name, size, sha256, upload_id, upload_ids, add_wmark."
      +  },
      +  {
      +    "const": "upload_url",
      +    "description": "Downloads a file from a public URL into the folder path. Returns per-item results. Required: url. Optional: path, name, add_wmark."
      +  },
      +  {
      +    "const": "upload_direct",
      +    "description": "Creates a one-time upload URL for a file of the given name and exact size, so binary files never pass through the model context. POST the raw bytes to the returned upload_url (for example with curl); the response is upload_id, filename, size and sha256. Pass upload_id to upload (with path), or as *_upload_id to the content and shop write tools. Required: filename or name, size."
      +  },
      +  {
      +    "const": "mkdir",
      +    "description": "Creates a folder. Required: path."
      +  },
      +  {
      +    "const": "rename",
      +    "description": "Renames one item (path and name) or several items in the folder path (items). Batch form returns per-item results. Required: path. Optional: name, items."
      +  },
      +  {
      +    "const": "move",
      +    "description": "Moves path, or every item of paths, into destination. The paths form returns per-item results. Required: destination. Optional: path, paths."
      +  }
      +]
  3. Added

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, destructiveHint=true and openWorldHint=true, so the write/destructive profile is covered. The description adds genuine value with the secrets-handling policy (owner uploads via control panel or FTP so the code can load it), but says nothing about permissions, overwrite-vs-create risk for content_put, or rate limits on multi-file uploads.

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

Conciseness5/5

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

Two sentences, zero waste: the capability list is front-loaded, and the safety constraint follows. The parenthetical enumerating text/base64/URL and the examples of secret files both earn their place.

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

Completeness4/5

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

For a destructive, 19-parameter, multi-action tool with no output schema, the definition pairs a clear capability scope with a security caveat, and the schema fills in per-action requirements and batch return behavior. The one remaining gap is that it does not position the tool against the other write-family siblings.

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 description coverage is 100% and the action enum carries per-action parameter lists via oneOf, so the schema does the heavy lifting for all 19 parameters. The description only restates the resource types touched ('creates folders, renames and moves items') and adds no syntax or format detail beyond what the schema already provides.

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 first sentence names a specific verb set and resource: upload/write/create/rename/move against the site file manager, and enumerates the accepted input forms (text, base64, URL). Read against siblings files_read and files_delete, an agent can immediately tell this is the mutating file tool without opening any schema.

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

Usage Guidelines3/5

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

The definition gives one explicit exclusion ('do not write files with secrets'), but that is a content-policy rule rather than tool routing. It never says when to pick this tool over content_write, templates_write, or apps_write, nor when to prefer files_read for inspection, so the agent must infer the boundary from the names alone.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.