Skip to main content
Glama

Date and time calculations in pure code

date_calc
Read-only

Date and time calculations in pure code. op=diff: calendar years, months and days between two dates, and the total days. op=add or subtract: move a date by years, months, weeks, days, hours or minutes (month ends are clamped). op=info: weekday, ISO week, day of year, quarter, and age from birthDate. op=tz: a local date-time in one IANA time zone shown in another. Impossible dates are a 400 with the reason. Price: $0.002 per successful call, paid with x402 (USDC on Base, Solana and 10 more networks); failed calls are not charged.

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": {
      "op": "<op>"
    },
    "name": "date_calc"
  }
}

Input Schema

NameRequiredDescriptionDefault
opYesdiff, add, subtract, info or tz
toNodiff: end date YYYY-MM-DD
asOfNoinfo: the date the age is counted to, default today (UTC)
dateNoadd, subtract, info: date YYYY-MM-DD
fromNodiff: start date YYYY-MM-DD; tz: local date-time YYYY-MM-DDTHH:MM
unitNoadd, subtract: years, months, weeks, days (default), hours or minutes
amountNoadd, subtract: whole number
to_zoneNotz: IANA zone to show, e.g. America/New_York
datetimeNotz: local date-time like 2026-10-15T09:30
birthDateNoinfo: date of birth YYYY-MM-DD, for the age
from_zoneNotz: IANA zone of the given time, e.g. Europe/Berlin

Output Schema

NameRequiredDescriptionDefault
opNo
toNo
daysNo
fromNo
yearsNo
monthsNo
sourceNo
checkedAtNo
directionNo
totalDaysNo
totalHoursNo
totalWeeksNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

Beyond readOnly/openWorld annotations the description discloses real behavior: month ends are clamped on arithmetic, impossible dates return a 400 with the reason, and pricing is $0.002 per successful call via x402 with failed calls not charged. Cost and failure semantics are exactly the kind of context annotations cannot convey.

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 the capability and then tightly organized by op= prefix, so an agent can scan for its case quickly. The pricing sentence is long but carries decision-relevant information; a couple of entries read as run-ons but nothing is padding.

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 11 parameters, a 100%-covered schema, an output schema, and readOnly annotations, the description covers the operation model, error behavior, and cost, which is what an agent needs to call and budget correctly. Only sibling routing (e.g., business-day counts) is absent.

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 baseline is 3, but the description adds cross-parameter meaning the schema cannot: which op consumes which inputs and the clamping rule for month-end arithmetic, plus default-today (UTC) behavior that mirrors asOf. It still leaves unit/amount interaction and tz input assumptions mostly to the schema.

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 names a concrete resource (date/time arithmetic) and enumerates the four operations with their exact outputs: diff yields calendar years/months/days plus total days, add/subtract moves a date by a unit, info yields weekday/ISO week/day-of-year/quarter/age, tz converts between IANA zones. An agent can map an intent to an op 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 Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Each op= entry effectively tells the agent which operation to select for which intent (span between two dates vs. shifting a date vs. metadata vs. zone conversion), which is strong implicit routing. It does not mention when to prefer a sibling such as business_days for working-day counts, so there is no explicit alternative or exclusion 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