Skip to main content
Glama

Date difference / add days

calc_date_diff
Read-onlyIdempotent

Calculate days, weeks, months, working days, or weekend days between two dates, or add/subtract days, business days, weeks, months, or years to a date with weekday and Hijri results.

Instructions

Two date jobs. difference: days between two dates (optionally counting the end day), as years/months/days, weeks, whole months, working days and weekend days for a chosen weekend (Fri–Sat default, Sat–Sun, Fri only, Sun only; public holidays are not counted). add: add or subtract days, business days, weeks, months or years to a date (month ends clamp: Jan 31 + 1 month = Feb 28/29). Results include the weekday and Umm al-Qura Hijri date. Dates are ISO YYYY-MM-DD; for Hijri ⇄ Gregorian conversion use calc_hijri. Web version: https://s3eidat.github.io/date-diff/

Input Schema

NameRequiredDescriptionDefault
endNodifference: end date YYYY-MM-DD (default today).
dateNoadd: the starting date YYYY-MM-DD (default today).
modeNodifference between two dates, or add/subtract an amount.difference
unitNoadd: unit of amount.days
startNodifference: start date YYYY-MM-DD (default today).
amountNoadd: how many units to add (use subtract to go back).
weekendNoWeekend days skipped by working-day counts.fri-sat
subtractNoadd: go back in time instead.
inclusiveNodifference: count the end date too.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/closed-world, but the description adds behavior the annotations cannot: public holidays are not counted, weekend definitions are configurable, month-end arithmetic clamps (Jan 31 + 1 month = Feb 28/29), and results include weekday and Umm al-Qura Hijri date. These are exactly the edge cases an agent needs for correct invocation.

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 and dense: two mode definitions followed by cross-cutting rules. Some parenthetical lists (weekend variants) are run-on, but nearly every clause carries operational information, so there is little waste.

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 9-parameter tool with no required parameters and no output schema, the description supplies defaults, output composition (weekday, Hijri date, multiple difference formats), edge-case arithmetic, and an alternative tool. An agent has everything needed to call it correctly.

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; the description goes further by explaining cross-parameter semantics such as the inclusive end-day option, default Fri–Sat weekend, and the clamping rule for month/year additions. It does not restate every parameter but adds real interpretive value.

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?

Opens with an explicit two-mode statement, then names each verb and resource: 'difference: days between two dates' and 'add: add or subtract days, business days, weeks, months or years'. It also names the sibling it is not (calc_hijri) and distinguishes the modes from each other, so an agent can pick the right tool without opening any 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?

Gives clear conditions for each mode and explicitly routes Hijri conversion to calc_hijri. It does not mention other plausible alternatives such as calc_due_date or calc_age, so the routing is good but not exhaustive.

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

Deploy Server

Other Tools