Skip to main content
Glama

Reporting period to exact dates

date_range
Read-onlyIdempotent

Turn a reporting period into exact start and end dates and times in a time zone: "last month", "this quarter", "YTD", "MTD", "last 7 days", "next 2 weeks", "2026-Q3", "2026-W14". Optional comparison period (previous period, or same period last year), fiscal years starting in any month, and Monday, Sunday or Saturday week starts. Use for analytics queries, SQL date filters, reports and dashboards. First 25 calls per day are free, then $0.001 per call (x402).

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": {
      "period": "<period>"
    },
    "name": "date_range"
  }
}

Input Schema

NameRequiredDescriptionDefault
as_ofNoReference date or datetime. Default today
periodYestoday, yesterday, this/last/next week|month|quarter|half|year, mtd, qtd, ytd, last_N_days|weeks|months, next_N_..., 2026, 2026-H1, 2026-Q3, 2026-03, 2026-W14, 2026-03-15. Fiscal (needs fiscal_year_start): "this fiscal year", "fiscal ytd", FY2027, "Q2 FY2027". Spaces work. last_N_days = complete days before today
compareNoComparison range: previous_period (or to-date: same days into the previous unit), previous_year (weeks: 52 weeks back). yoy works
timezoneNoIANA time zone, e.g. America/New_York (default UTC)
week_startNoWeek start; monday = ISO weeksmonday
include_todayNoEnd with today. Default true for *_to_date, false for last_N_*
fiscal_year_startNoFiscal year's first month (1-12). FY named by its end year: start 7, FY2027 = Jul 2026-Jun 2027

Output Schema

NameRequiredDescriptionDefault
daysYes
as_ofYes
labelYes
startYes
periodYes
end_dateYes
timezoneYes
start_utcYes
comparisonNo
start_dateYes
week_startNo
end_exclusiveYesExclusive end; filter >= start and < end_exclusive
end_exclusive_utcYes
fiscal_year_startNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed17 schema fields changed
    • changedInput schema / properties / as_of / description
      Previous value: -"Reference date for relative periods: YYYY-MM-DD, or a datetime (its local date is used). Default: today in timezone"New value: +"Reference date or datetime. Default today"
    • changedInput schema / properties / compare / description
      Previous value: -"Also return a comparison range. previous_period: the same length immediately before (to-date periods: the same number of days into the previous unit). previous_year: the same dates a year earlier (weeks: 52 weeks earlier, same weekdays)"New value: +"Comparison range: previous_period (or to-date: same days into the previous unit), previous_year (weeks: 52 weeks back). yoy works"
    • changedInput schema / properties / fiscal_year_start / description
      Previous value: -"Month the fiscal year starts (1 = January). Quarters, halves and years follow it; fiscal years are named by the calendar year they end in (start 7: FY2027 = July 2026 – June 2027)"New value: +"Fiscal year's first month (1-12). FY named by its end year: start 7, FY2027 = Jul 2026-Jun 2027"
    • changedInput schema / properties / include_today / description
      Previous value: -"End the range with today (inclusive). Default true for *_to_date periods, false for last_N_* periods (complete days only)"New value: +"End with today. Default true for *_to_date, false for last_N_*"
    • changedInput schema / properties / period / description
      Previous value: -"Relative: today, yesterday, tomorrow, this_/last_/next_ + week|month|quarter|half|year, week_to_date|month_to_date|quarter_to_date|year_to_date (or wtd, mtd, qtd, ytd), last_N_days|weeks|months|quarters|years, next_N_days|weeks|months|... Spaces work too (\"last 7 days\"). last_N_days = N complete days before today; last_N_months = N complete calendar months before this one. Explicit: 2026, 2026-H1, 2026-Q3 or \"Q3 2026\", 2026-03, 2026-W14 (ISO week), 2026-03-15"New value: +"today, yesterday, this/last/next week|month|quarter|half|year, mtd, qtd, ytd, last_N_days|weeks|months, next_N_..., 2026, 2026-H1, 2026-Q3, 2026-03, 2026-W14, 2026-03-15. Fiscal (needs fiscal_year_start): \"this fiscal year\", \"fiscal ytd\", FY2027, \"Q2 FY2027\". Spaces work. last_N_days = complete days before today"
    • changedInput schema / properties / week_start / description
      Previous value: -"First day of the week. monday = ISO weeks (labels like 2026-W46)"New value: +"Week start; monday = ISO weeks"
    • removedOutput schema / properties / as_of / description
      Removed value: -"The local date that relative periods were resolved against"
    • removedOutput schema / properties / comparison / properties / end_date / description
      Removed value: -"Last day, inclusive (YYYY-MM-DD)"
    • removedOutput schema / properties / comparison / properties / end_exclusive / description
      Removed value: -"Local end, exclusive: the midnight after end_date. Filter with >= start and < end_exclusive"
    • removedOutput schema / properties / comparison / properties / start / description
      Removed value: -"Local start, ISO 8601 with offset (local midnight)"
    • removedOutput schema / properties / comparison / properties / start_date / description
      Removed value: -"First day (YYYY-MM-DD)"
    • removedOutput schema / properties / end_date / description
      Removed value: -"Last day, inclusive (YYYY-MM-DD)"
    • changedOutput schema / properties / end_exclusive / description
      Previous value: -"Local end, exclusive: the midnight after end_date. Filter with >= start and < end_exclusive"New value: +"Exclusive end; filter >= start and < end_exclusive"
    • removedOutput schema / properties / fiscal_year_start / description
      Removed value: -"Month name, when not January"
    • removedOutput schema / properties / label / description
      Removed value: -"e.g. \"October 2026\", \"Q3 2026\", \"2026-W46\", \"FY2027\", or \"start to end\""
    • removedOutput schema / properties / start / description
      Removed value: -"Local start, ISO 8601 with offset (local midnight)"
    • removedOutput schema / properties / start_date / description
      Removed value: -"First day (YYYY-MM-DD)"
  2. Added

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint, idempotentHint, closed-world), so the description's real contribution is the commercial/auth behavior: 'First 25 calls per day are free, then $0.001 per call (x402)'. That is genuinely useful context an agent cannot get from the schema, though it does not discuss rate limiting beyond the free tier or error behavior.

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?

The core action and its examples are front-loaded, followed by optional capabilities, use cases, and pricing. The middle option-listing sentence is dense but each clause maps to a real capability; only the pricing tail is arguably tangential to invocation.

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 and 100% parameter coverage, the description need not explain return values, and it correctly focuses on period syntax, defaults, and cost. It is close to complete for a pure computation tool, missing only explicit sibling disambiguation.

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 description coverage is 100%, so the parameters are already fully documented, and the description largely restates them (comparison periods, fiscal-year starts, week-start options). It adds no syntax or edge-case detail beyond what 'period', 'compare', 'week_start', and 'fiscal_year_start' already say.

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 opens with a specific verb+resource pair — 'Turn a reporting period into exact start and end dates and times in a time zone' — and backs it with concrete period examples ('last month', 'YTD', '2026-Q3', '2026-W14'). This clearly separates it from siblings like date_add, date_diff, or parse_date_text, which manipulate dates rather than resolve named periods into ranges.

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?

It offers positive usage context ('Use for analytics queries, SQL date filters, reports and dashboards') but never states when not to use it or which sibling to prefer when the input is a free-form date string rather than a period. The guidance is implied by example rather than explicit routing.

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.