Skip to main content
Glama

Leer duración ISO 8601

duration-parse
Read-onlyIdempotent

Analiza una duración ISO 8601 (p. ej. P1Y2M3DT4H5M6S) en componentes y segundos totales. Cuándo: un resultado de fechas, zonas horarias o calendario tiene que ser exacto (desfases, horario de verano, fines de mes, bisiestos). No para: formatear segundos como duración ISO 8601, texto compacto, reloj y palabras en inglés o español (duration-format). 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: Parses an ISO 8601 duration (e.g. P1Y2M3DT4H5M6S, PT90M, P2W) into components and total seconds (years = 365.2425 days and months = 30.436875 days, flagged as approximate). When: a date, time-zone or calendar result has to be exact (offsets, daylight saving, month ends, leap years). Not for: formatting a number of seconds as an ISO 8601 duration (duration-format). [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
durationYesISO 8601 duration (string; required; up to 100 chars).

Output Schema

NameRequiredDescriptionDefault
daysNo
signNo
hoursNo
weeksNo
yearsNo
monthsNo
minutesNo
secondsNo
approximateNo
total_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / duration / examples
      Added value: +[
      +  "P1DT2H30M"
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Parses an ISO 8601 duration (e.g. P1Y2M3DT4H5M6S, PT90M, P2W) into components and total seconds (years = 365.2425 days and months = 30.436875 days, flagged as approximate). When: a date, time-zone or calendar result has to be exact (offsets, daylight saving, month ends, leap years). Not for: formatting a number of seconds as an ISO 8601 duration (duration-format). 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?

Goes beyond annotations by disclosing runtime limits (64 KB input, 1 s per call, 1 MB result), determinism, and the crucial approximation rule that years=365.2425 days and months=30.436875 days with a flag. The side-effects sentence largely restates readOnlyHint/openWorldHint=false, so a small part of the text is redundant with structured data.

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?

Front-loaded with purpose, then When/Not-for, then effects and limits — good ordering. It is somewhat long due to the bilingual duplication and the trailing "[EN completo / full EN: inputSchema.description]" pointer, which adds bulk without 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?

For a single-parameter pure function with an output schema and full annotations, the description covers purpose, routing, determinism, limits, and the approximate-unit caveat. Nothing an agent needs in order to call it 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?

With one parameter at 100% schema coverage (including maxLength and an example), the schema already carries the semantics, so the baseline applies. The description adds extra example formats (PT90M, P2W) and the Y/M conversion rule, but nothing about the parameter itself that the schema lacks.

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 ("Analiza/parses an ISO 8601 duration") plus what it returns (components and total seconds). It explicitly distinguishes itself from the sibling duration-format, so an agent can tell the two apart without opening either 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?

The "Cuándo/When" clause names the concrete conditions (offsets, DST, month ends, leap years) and the "No para/Not for" clause routes formatting tasks to duration-format by name. Both the positive and negative selection criteria are explicit.

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