Skip to main content
Glama

detect_text_direction

Detect whether mixed Persian/English text is RTL or LTR and optionally wrap usernames, product names, or strings with bidi-safe Unicode isolates or HTML tags to prevent display issues.

Instructions

Detect text direction (first-strong and dominant script, mixed flag) and optionally wrap the text bidi-safely: Unicode isolates (FSI/RLI/LRI) or HTML / dir=auto. Use for usernames, product names and mixed Persian/English strings.

Input Schema

NameRequiredDescriptionDefault
textYes
wrapNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations and no output schema, the description carries the burden and does reasonably well: it discloses the three detection outputs and enumerates the safe-wrapping modes (FSI/RLI/LRI isolates vs. HTML bdi / dir=auto). It does not describe error handling or the exact return shape, so it stops short of full disclosure.

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?

Two dense sentences with no filler; the core detection capability is front-loaded and the optional wrapping plus usage hint follow. Every clause carries information.

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?

For a two-parameter, annotation-free tool with no output schema, the description covers purpose, the detection outputs, the wrap modes, and usage context, which is close to sufficient. The main gap is the absence of a described return shape, which no structured field supplies.

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 description coverage is 0%, so the description must compensate. It meaningfully categorizes the wrap enum values ('Unicode isolates (FSI/RLI/LRI)' and 'HTML <bdi> / dir=auto'), adding semantics beyond the bare enum strings, and the text parameter is self-evident. It never explicitly names the 'wrap' parameter, so it is not fully explicit.

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 (detect) and resource (text direction) and clarifies the two outputs it produces (first-strong direction, dominant script, mixed flag) plus an optional wrapping capability. It is clearly distinguishable from siblings like rtl_guidelines or rtl_audit_css, which are about CSS/layout rather than direction detection.

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 concrete usage context: 'Use for usernames, product names and mixed Persian/English strings.' This is a clear positive signal for when to reach for the tool, though it offers no explicit when-not guidance or named alternative (e.g., versus rtl_guidelines).

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