Skip to main content
Glama

convert_encoding

DestructiveIdempotent

Convert a file from one character encoding to another, with automatic source detection and BOM handling. Create a backup before irreversible conversions.

Instructions

Convert file from one encoding to another. Use after detect_encoding to identify the source. A source BOM is stripped before decoding, and a conflict between the BOM and an explicit 'from' is an error. No-op if the file already holds the target bytes. Parameters: path (required), from (source encoding, auto-detected if omitted), to (target encoding, required), backup (create .bak file before converting, default: false), bom (optional: "auto" default — BOM for UTF-16 targets and keeps a same-encoding source BOM; "always", "never", "preserve"). IMPORTANT: Use backup=true for irreversible conversions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYes
bomNo
fromNo
pathYes
backupNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
hasBomYes
bomTypeNo
changedYes
messageYes
backupPathNo
sourceEncodingYes
targetEncodingYes
Behavior5/5

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

The description explains BOM handling (stripping, conflict errors), no-op behavior for already correct encodings, and the backup option. Annotations already declare idempotentHint=true and destructiveHint=true, and the description adds valuable 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?

The description is approximately 5 sentences, each adding value. It is front-loaded with the core purpose and uses bullet-like clarity for parameters. No wasted words.

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?

Given the tool's complexity (5 parameters, BOM handling), the description covers all key aspects: conversion, BOM, backup, no-op condition, and additional output schema exists (though not shown). It is fully complete.

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?

Input schema has 0% description coverage, but the description fully explains all 5 parameters: path (required), from (auto-detected), to (required), backup (default false), and bom (with auto/always/never/preserve details).

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 description starts with 'Convert file from one encoding to another,' naming the verb and resource. It also distinguishes from sibling tools like detect_encoding and list_encodings by saying 'Use after detect_encoding to identify the source.'

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

Usage Guidelines4/5

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

The description provides clear guidance on when to use the tool ('Use after detect_encoding') and an important caution about irreversible conversions. It lacks explicit when-not-to-use but is sufficient for correct selection.

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