compare_periods
Compare total spend across two date ranges, optionally for one category, and get both totals plus the USD and percent change. Use it to avoid manual difference calculations.
Instructions
Compare total spend between two date ranges (period A = baseline, period B = comparison), optionally for one category. Returns both totals, the change in USD and the change in percent, all computed deterministically. Use this instead of calculating differences yourself.
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_a_start": "<period_a_start>",
"period_a_end": "<period_a_end>",
"period_b_start": "<period_b_start>",
"period_b_end": "<period_b_end>"
},
"name": "compare_periods"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Exact category name, case-insensitive | |
| period_a_end | Yes | YYYY-MM-DD | |
| period_b_end | Yes | YYYY-MM-DD | |
| period_a_start | Yes | YYYY-MM-DD | |
| period_b_start | Yes | YYYY-MM-DD |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | No | finance.expenses | |
| category | Yes | ||
| currency | No | USD | |
| period_a | Yes | ||
| period_b | Yes | ||
| change_pct | Yes | 100 * change / period_a total, 2 dp; null if period_a is 0 | |
| change_amount | Yes | period_b total minus period_a total | |
| metric_version | No | finance-metrics/1 |