Skip to main content
Glama

Write File

write_file

Create or fully replace a single file in a Google Apps Script project while keeping other files intact. Specify the file name without extension and choose JS, HTML, or JSON type.

Instructions

Create or fully replace one file in a project; other files are kept.

name has no extension ("Code", not "Code.gs"). type defaults to SERVER_JS, or JSON for the "appsscript" manifest; use HTML for HtmlService templates.

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": {
      "script_id": "<script_id>",
      "name": "<name>",
      "source": "<source>"
    },
    "name": "write_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYes
typeNo
sourceYes
script_idYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose the key behavioral trait: the target file is FULLY replaced (existing contents lost) while other files are preserved. It omits permission/scope requirements, failure behavior, and what happens on concurrent edits, so it is strong but not complete.

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?

The critical fact (full replace, siblings preserved) is front-loaded in sentence one, and the remaining lines are dense, example-bearing parameter notes with no filler.

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

Completeness3/5

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

An output schema exists so return values need not be described, and the overwrite semantics are covered. Gaps remain for a mutation tool with zero annotations: no mention of authorization needs, error conditions, or what script_id refers to.

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 0%, so the description must compensate. It does so for two of four parameters with genuinely useful semantics (name has no extension; type defaults to SERVER_JS, JSON for the appsscript manifest, HTML for HtmlService templates), but script_id and source get no explanation at all.

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?

"Create or fully replace one file in a project; other files are kept" names a specific verb pair and resource, and the scope qualifier ("one file", "other files are kept") separates it from a bulk write and from delete_file without needing the 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 create-or-replace framing implies when to use it (single-file writes) versus delete_file, but there is no explicit when-to-use or when-not-to-use statement and no named alternative. Usage must be inferred from the scope clause.

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