Skip to main content
Glama

Escapar cadena JSON

json-string-escape
Read-onlyIdempotent

Escapa texto como literal de cadena JSON. Cuándo: hay que convertir bytes o texto a esta codificación, o desde ella, con exactitud y sin adivinar. No para: interpretar el cuerpo de un literal de cadena JSON y devolver el texto (json-string-unescape). 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: Escapes text as the body of a JSON string literal (quotes, backslashes, control characters), with or without surrounding quotes. When: bytes or text have to be converted to or from this encoding exactly, without guessing. Not for: parsing the body of a JSON string literal (json-string-unescape). 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.

Input Schema

NameRequiredDescriptionDefault
textYesText (string; required).
quotesNoInclude surrounding quotes (boolean; optional; default false).

Output Schema

NameRequiredDescriptionDefault
escapedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / text / examples
      Added value: +[
      +  "He said \"hi\"\n"
      +]
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

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

The annotations already declare readOnly, idempotent, non-destructive, and closed-world, so the baseline bar is low; the description still adds genuine value with determinism and operational limits (64 KB input, 1 s, 1 MB output). However the stated 64 KB input cap conflicts with the schema's maxLength of 1048576, which could make an agent reject or pre-truncate valid input.

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 is front-loaded and the labelled sections (When / Not for / Side effects / Deterministic / Limits) make it highly scannable. The full Spanish and English duplication doubles the length, and the limits line carries the size inconsistency, costing some tightness.

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?

With an output schema present, return values need no explanation, and the description covers purpose, alternative, side effects, and limits. The only real gap is the internal mismatch between the advertised 64 KB input limit and the schema's 1 MB maxLength, which leaves the actual boundary unclear.

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 both 'text' and 'quotes'. The description reinforces the optional-quote behaviour ('con o sin comillas') but adds no syntax, encoding, or edge-case detail beyond what the schema provides. Baseline 3 applies.

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: escapes text into the body of a JSON string literal, naming exactly which characters (quotes, backslashes, control characters). It explicitly distinguishes itself from json-string-unescape, which is its only near-identical sibling in a very large tool list.

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?

Provides an explicit 'Cuándo/When' condition and an explicit 'No para/Not for' exclusion that names the alternative tool (json-string-unescape). An agent can route between the encode/decode pair without opening either schema.

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