Skip to main content
Glama

write_file

DestructiveIdempotent

Write files by converting UTF-8 content to a target encoding, with BOM handling. Use after reading a file to preserve its original encoding.

Instructions

Write file with encoding conversion from UTF-8. PREFER THIS over built-in Write for non-UTF-8 files — converts UTF-8 content to target encoding, preserving legacy compatibility. Parameters: path (required), content (required), encoding (optional: defaults to an existing file's detected encoding, else utf-8), bom (optional: "auto" default — BOM for UTF-16 targets and keeps a BOM the file already had; "always", "never", "preserve"). Use after read_text_file to preserve original encoding.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bomNo
pathYes
contentYes
encodingNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
hasBomYes
bomTypeNo
messageYes
Behavior5/5

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

Discloses encoding conversion, default behavior, BOM handling, and legacy compatibility; adds significant context beyond annotations.

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?

Concise yet comprehensive; each sentence adds value, front-loading main purpose then detailing parameters.

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

Completeness5/5

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

Covers all aspects: purpose, usage, parameters, defaults, and relation to sibling tools; output schema exists so return value not needed.

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

Parameters5/5

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

Despite 0% schema coverage, description explains all four parameters with defaults and options, fully compensating for schema lack.

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?

Description clearly states 'Write file with encoding conversion from UTF-8', specifies the action and resource, and distinguishes from siblings like built-in Write.

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

Usage Guidelines5/5

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

Explicitly recommends using this tool over built-in Write for non-UTF-8 files and advises using after read_text_file, providing clear when-to-use guidance.

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

Install Server

Other Tools

Latest Blog Posts

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/dimitar-grigorov/mcp-file-tools'

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