Skip to main content
Glama

Detect language

ai_detect_language
Read-onlyIdempotent

Detects the language and writing system of text or a file, returning top candidates with scores, ISO codes, and script shares; useful for routing, filtering, or validating multilingual content.

Instructions

Detect the language of a text with franc-min (82 languages with 8M+ speakers, ISO 639-3 codes) and the writing systems it uses (Latin, Arabic, Cyrillic, Han/CJK, Hangul, Devanagari, Greek, Hebrew, Thai…). Returns the top 3 candidates with scores (1 = best match, relative to the others), English names and ISO 639-1 codes where they exist, plus a share per script. Texts under 20 characters are "too short": only the script is reported. Works best on a sentence or more of one language; for mixed text the dominant script wins; long texts are judged on their first 100,000 characters. Hebrew is not among the languages (script only). Give "text" or "path" (file path or base64).

Input Schema

NameRequiredDescriptionDefault
onlyNoRestrict to these ISO 639-3 codes (e.g. ["arb","eng","fra"]).
pathNoOr: a UTF-8 text/markdown file, as a local path or base64 (raw or a data: URI).
textNoThe text (inline).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnlyHint/idempotentHint, so the safety profile is covered; the description still adds substantial non-obvious behavior: top-3 candidate scoring semantics, the 20-character too-short threshold, dominant-script rule for mixed text, 100,000-character truncation, and the Hebrew exclusion. These are exactly the edge cases an agent would otherwise get wrong.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Information-dense but front-loaded: core purpose and return format first, then caveats, then input contract. It is long-ish for one paragraph, yet nearly every clause carries a distinct constraint that is not restated elsewhere.

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?

There is no output schema, so the description carries the return-value burden and does so thoroughly (top-3 with scores, names, ISO 639-1, per-script shares). Combined with the degradation rules and input contract, an agent has everything needed to call it and interpret results.

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 coverage is 100%, so baseline is 3, but the description adds the one-of contract between 'text' and 'path' that the schema (0 required params, no oneOf) does not express, and clarifies the expected file type (UTF-8 text/markdown). 'only' is left to the schema, which documents it adequately.

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?

States a specific verb+resource ('Detect the language of a text') and immediately names the engine and scope (franc-min, 82 languages, ISO 639-3) plus the secondary output (writing systems). It also spells out exactly what is returned, so an agent knows the tool's output shape from the description alone.

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?

Gives real operating guidance: best on a sentence or more of one language, mixed text falls back to the dominant script, and short inputs (<20 chars) degrade to script-only. It also states the input contract ('Give "text" or "path"'). No alternatives are named, but no sibling performs language detection, so there is nothing to route against.

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

Deploy Server

Other Tools