Skip to main content
Glama

detect_encoding

Read-only

Determine a file's character encoding with a confidence score and BOM detection. Run this before reading text to resolve garbled characters or mojibake.

Instructions

Auto-detect file encoding with confidence score (0-100) and BOM detection. ALWAYS use this first when encountering garbled text or � characters. Use before read_text_file to determine the correct encoding. Parameters: path (required), mode (sample=fast default, chunked=thorough, full=entire file). When the answer is in doubt — low confidence, or a charset this server cannot read — the result also ranks candidates; retry the read with a supported one and ask the user if two are plausible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
has_bomYes
encodingYes
candidatesNo
confidenceYes
Behavior5/5

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

Beyond the readOnlyHint, the description adds behavioral context including confidence scoring, BOM detection, multiple modes (sample, chunked, full), and candidate ranking on low confidence. This fully discloses the tool's behavior and limitations.

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 front-loaded with the core purpose, followed by usage guidance, parameter details, and edge-case behavior. Every sentence adds value without unnecessary fluff.

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 presence of an output schema, the description need not detail return values, but it covers the key aspects of usage, parameters, and exceptional cases, making it complete for this tool.

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?

With 0% schema description coverage, the description compensates by explaining path as required and detailing mode values (sample, chunked, full) along with their semantics, exceeding the bare schema types.

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 clearly states the tool auto-detects file encoding with confidence score and BOM detection, using a specific verb and resource. It distinguishes itself from siblings like read_text_file and convert_encoding by positioning itself as the preliminary step before reading.

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?

It explicitly instructs to ALWAYS use this first when encountering garbled text, and to use before read_text_file. It also provides guidance on what to do when confidence is low, such as retrying with a supported encoding and asking the user.

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