Skip to main content
Glama

Date Math

Date difference

date_diff
Read-onlyIdempotent

Difference between two dates or datetimes: calendar (Y/M/D), total days/weeks/hours, and business days (weekdays in [from, to) minus holidays; pass country to exclude its public holidays). Costs $0.001 per call (x402).

Input Schema

NameRequiredDescriptionDefault
toYesYYYY-MM-DD, or ISO 8601 datetime with Z or offset
fromYesYYYY-MM-DD, or ISO 8601 datetime with Z or offset
countryNoISO 3166-1 alpha-2 country code (207 countries); its public holidays (2000–2050) are excluded from business days
holidaysNoDates excluded from business-day counts (weekends are always excluded)

Output Schema

NameRequiredDescriptionDefault
toYes
fromYes
calendarYes
directionYes
total_daysYes
total_hoursNoDatetime inputs only
total_weeksYes
iso_durationYes
business_daysNoWeekdays in [from, to) minus holidays (date inputs only)
total_minutesNo
total_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already cover read-only, idempotent, closed-world behavior, so the bar is lower. The description adds genuinely useful non-schema context: the $0.001 per-call x402 cost, plus the half-open interval and weekend/holiday exclusion semantics for business days. It does not contradict any annotation, though it says nothing about error behavior for invalid or reversed date ranges.

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?

One front-loaded sentence covering result modes, followed by the interval semantics and the cost. The nested parenthetical about business days is dense and slightly hard to parse, but every clause carries information an agent needs.

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, the description need not explain return values, and annotations plus full schema coverage handle the safety and parameter burden. The remaining relevant additions, pricing and counting semantics, are present; only comparative usage guidance against the many date siblings 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?

Schema coverage is 100%, so all four parameters are documented at the source, making 3 the baseline. The description adds marginal value by reiterating the 'pass country to exclude its public holidays' behavior, but that semantics is already present in the country and holidays property descriptions, so little is added beyond the schema.

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?

Opens with a specific verb+resource ('Difference between two dates or datetimes') and enumerates the result modes (calendar Y/M/D, total days/weeks/hours, business days), which makes it clearly distinct from the additive sibling date_add. It stops short of naming any sibling explicitly, so the differentiation is inferential rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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

The description explains the business-day counting rule and that passing country excludes public holidays, which gives some guidance on parameter choice. It never states when to use this tool versus date_add, business_hours_deadline, or working_hours_overlap, and there are no exclusions or prerequisites.

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.