Skip to main content
Glama

source_write

Destructive

Validates and atomically replaces an existing X++ source file, preserving encoding and newlines, with a dry-run diff by default.

Instructions

Dry-run or atomically replace an existing source file after validation, preserving encoding and newlines.

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": "source_write"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
rootNo
dryRunNo
contentYes
expectedSha256No

Output Schema

NameRequiredDescriptionDefault
okYes
diffNo
pathNo
errorNo
dryRunNo
sha256No
changedNo
diagnosticsNo
diffTruncatedNo
previousSha256No

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.16.0

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, idempotentHint=false and openWorldHint=false, so the risk profile is covered. The description adds real value beyond that: a dry-run mode exists, replacement is atomic, validation gates the write, and encoding/newlines are preserved. It omits the default of dryRun=true and any note on the SHA-256 precondition, which are the remaining behavioral gaps.

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 sentence, densely front-loaded with the mode choice and the atomicity guarantee, then the preconditions. Nothing is padding and nothing important is buried.

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?

An output schema exists, so return values need no explanation, and the safety profile is carried by annotations. The remaining shortfall is parameter-level: a destructive write tool with 0% schema coverage should explain expectedSha256 and root scoping, which the description does not.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across five parameters, so the description carries the full burden and does not meet it. It implies a dry-run toggle and a content/path pair, but never mentions expectedSha256, root, or the default dryRun=true — an agent could easily omit the concurrency guard or write to the wrong root.

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 names a specific verb pair ('Dry-run or atomically replace') and a precise resource ('an existing source file'), plus qualifiers ('after validation', 'preserving encoding and newlines') that separate it from source_read/source_validate. It stops short of naming a sibling, but the 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?

'Existing source file' implicitly excludes creation, and 'after validation' hints that source_validate should run first, but neither is stated as a rule. There is no explicit when-not guidance and no named alternative for reading or creating files.

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