Skip to main content
Glama

parse_duration

Read-onlyIdempotent

Converts human-readable duration strings like '2h30m' or '1d6h' into total seconds, enabling arithmetic and comparison of free-text durations.

Instructions

Parses a human-readable duration string into structured seconds. Supports combinations of y (years), mo (months), w (weeks), d (days), h (hours), m (minutes), s (seconds). Examples: '2h30m', '1d6h', '1w3d', '45m'. Returns the total seconds for the duration. Use when normalising a free-text duration for arithmetic or comparison.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "duration_string": "<duration_string>"
    },
    "name": "parse_duration"
  }
}

Input Schema

NameRequiredDescriptionDefault
duration_stringYesDuration string like "2h30m", "1d6h", "45m".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.0
    • removedInput schema / additionalProperties
      Removed value: -false
  2. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, closed-world and non-destructive, so the safety profile is covered. The description adds real context beyond that: the accepted unit vocabulary (including the m/mo distinction implied by listing both) and the fact that it returns total seconds. It does not state behavior on invalid input or mixed unit ordering, which is the remaining gap.

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?

Four short sentences, front-loaded with the verb+resource, then units, then examples, then return value and usage. Every sentence contributes and nothing is repeated from the schema verbatim.

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 single-parameter pure function with no output schema, it covers input grammar, examples, and return type, which is enough to call it correctly. Only error/failure semantics are unstated.

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 coverage is 100%, so the baseline is 3, and the description earns an increment by explaining that the string is a combination of unit tokens and that the result is total seconds — semantics the schema's bare example does not spell out.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb ('Parses') and resource ('human-readable duration string into structured seconds'), plus enumerates the supported unit tokens. An agent knows exactly what this does, though it does not name a sibling it is distinct from (e.g. time_math, convert_timezone).

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?

'Use when normalising a free-text duration for arithmetic or comparison' gives a clear triggering condition. No explicit exclusions or named alternatives are offered, so it stops short of full routing guidance.

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