Skip to main content
Glama

Fragmentar texto para RAG

rag-chunk
Read-onlyIdempotent

Divide un texto en fragmentos de hasta N caracteres o tokens estimados con solapamiento, respetando párrafos, oraciones y palabras. Cuándo: un flujo de agente necesita un resultado exacto y repetible para un paso auxiliar (tokens, costos, reintentos, fragmentos, ranking, limpieza de JSON). No para: dividir un texto en español en oraciones, considerando ¿…? y ¡…!, puntos suspensivos, decimales y miles (es-sentence-split). 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: Splits text into chunks of at most N characters or estimated tokens with overlap, preferring paragraph, then sentence, then word boundaries; returns offsets for citation. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
textYesText (string; required).
unitNoSize unit (optional; one of: characters, tokens; default "characters").characters
overlapNoOverlap in the same unit (default 10% of max_size) (integer; optional; min 0; max 50000).
max_sizeNoMax chunk size (integer; optional; default 1000; min 20; max 100000).

Output Schema

NameRequiredDescriptionDefault
countNo
chunksNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / text / examples
      Added value: +[
      +  "Uno dos tres. Cuatro cinco seis. Siete ocho nueve."
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Splits text into chunks of at most N characters or estimated tokens with overlap, preferring paragraph, then sentence, then word boundaries; returns offsets for citation. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). Not for: splitting Spanish text into sentences, aware of ¿…? and ¡…!, ellipses, decimals and thousands (es-sentence-split). 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.6/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, and the description reinforces this with determinism and operational limits (1 s per call, result up to 1 MB) that are not in the annotations. However, it states 'entrada JSON de hasta 64 KB' while the schema allows text up to 1,048,576 characters, an inconsistency that could mislead an agent about the real input ceiling.

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?

The content is well front-loaded (purpose, then when/not-for, then side effects, determinism, limits) and every block carries information. It loses a point because the English block duplicates the Spanish almost verbatim and the trailing '[EN completo / full EN: inputSchema.description]' pointer adds noise rather than value.

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 and 100% parameter coverage, the description only needs to supply routing, determinism, and limits — all of which it does. Nothing an agent needs in order to call it correctly (boundary behavior, overlap, size limits, side-effect profile) is missing.

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 100%, so baseline is 3; the description adds genuine meaning beyond the schema by explaining that splitting prefers paragraph, then sentence, then word boundaries, which is not stated per-parameter. It also clarifies the 'estimated tokens' nature of the unit enum, though it doesn't elaborate on overlap vs max_size interaction.

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 opens with a specific verb, resource, and the numeric/overlap semantics of the result ('Divide un texto en fragmentos de hasta N caracteres o tokens estimados con solapamiento'). It also distinguishes itself from the closest sibling by naming es-sentence-split as the tool for sentence-only Spanish splitting.

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 contains an explicit 'Cuándo:' section describing the triggering context (bookkeeping steps in an agent loop: tokens, costs, retries, ranking, JSON clean-up) and a 'No para:' section naming the competing tool by name plus the exact case that belongs to it. The alternative routing decision is fully spelled out.

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