Skip to main content
Glama

fs_write

Write or append text files inside the sandbox, with optional parent-directory creation, when file write access is enabled.

Instructions

向沙箱内写入文本文件(需开启 files.allow_write)。

Args: path: 相对于沙箱根目录的文件路径。 content: 要写入的文本内容。 append: 是否追加而不是覆盖。 create_dirs: 是否自动创建父目录。

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": {
      "path": "<path>",
      "content": "<content>"
    },
    "name": "fs_write"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
appendNo
contentYes
create_dirsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It does disclose the permission gate and the append-vs-overwrite behavior, which are real behavioral facts. However, it says nothing about what happens to existing content on overwrite beyond the word '覆盖', nor about encoding, size limits, or failure behavior when the permission is off.

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?

One purpose sentence followed by a compact per-parameter list; every line adds information and the purpose is front-loaded. No filler or repetition of the name.

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?

For a filesystem mutation with zero annotation coverage, the definition should flag the destructive overwrite risk and the failure mode when files.allow_write is disabled. An output schema exists, so return values need not be explained, but the behavioral gaps around data loss and errors leave it only adequate.

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 description coverage is 0%, so the description must compensate, and it does: all four parameters are explained in the Args block, including the path being relative to the sandbox root and the append/create_dirs boolean meanings. Only the non-obvious defaults (create_dirs defaults true) come from the schema rather than the text.

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 description opens with a specific verb plus resource ('向沙箱内写入文本文件') and names the required capability ('需开启 files.allow_write'), which lets an agent distinguish it from read-oriented siblings like fs_read and fs_stat. It stops short of explicitly contrasting with fs_mkdir or kb_add, but the write/sandbox scope is unambiguous.

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 precondition 'files.allow_write must be enabled' is the only usage signal; there is no statement of when to use this versus fs_mkdir (for directories) or kb_add (for knowledge base content). Usage is implied by the write semantics rather than stated.

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