Skip to main content
Glama

Distancia de Levenshtein

levenshtein-distance
Read-onlyIdempotent

Calcula la distancia de edición de Levenshtein entre dos cadenas y similitud normalizada. Cuándo: hay que transformar, comparar o medir un texto con exactitud y no por aproximación. No para: medir la distancia de edición que también cuenta caracteres vecinos intercambiados (damerau-levenshtein). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Computes the edit distance (insertions, deletions, substitutions) between two strings by code point, plus a normalized similarity 1 - d/max(len). Length product capped at 4M. When: text has to be transformed, compared or measured exactly instead of approximated. Not for: measuring edit distance that also counts swapped adjacent characters (damerau-levenshtein). Side effects: none (read-only, no network access, no stored state). [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
aYesFirst string (string; required; up to 20000 chars).
bYesSecond string (string; required; up to 20000 chars).
case_sensitiveNoCase sensitive (boolean; optional; default true).

Output Schema

NameRequiredDescriptionDefault
distanceNo
similarityNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / a / examples
      Added value: +[
      +  "kitten"
      +]
    • addedInput schema / properties / b / examples
      Added value: +[
      +  "sitting"
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Computes the edit distance (insertions, deletions, substitutions) between two strings by code point, plus a normalized similarity 1 - d/max(len). Length product capped at 4M. When: text has to be transformed, compared or measured exactly instead of approximated. Not for: measuring edit distance that also counts swapped adjacent characters (damerau-levenshtein). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB."
  3. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint=false and destructiveHint=false, so the safety profile is covered. The description still adds real value: explicit determinism guarantee and hard operational limits (64 KB JSON input, 1 s per call, 1 MB result, length product capped at 4M) that are nowhere in the annotations or schema.

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?

Purpose, exclusion, side effects and limits are all front-loaded and each section earns its place. It loses a point because the Spanish and English blocks are near-verbatim duplicates, roughly doubling length without adding new information.

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?

With an output schema present, return values need not be described, and the description still covers purpose, alternatives, determinism, side effects and resource limits. Nothing an agent needs to call this correctly is missing.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents a, b and case_sensitive including defaults and maxLength. The description contributes the length-product cap and code-point semantics, but says nothing about case_sensitive's effect on the comparison — baseline 3 is appropriate when the schema carries the parameter burden.

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 and resource — computing Levenshtein edit distance (insertions, deletions, substitutions) by code point plus a normalized similarity formula. It also names the exact operation it is NOT (damerau-levenshtein), so an agent can distinguish it from the many string-similarity siblings without opening the schema.

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?

Explicit 'Cuándo/When' and 'No para/Not for' sections give both the positive selection criterion (exact text comparison/measurement rather than approximation) and the negative one (do not use when transpositions count — use damerau-levenshtein). The alternative is named outright, which is the strongest form of routing guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources