shelf_life_calculator
Work out an expiry date, a production date or a shelf life from the other two, and how much of the shelf life is left on a check date. Send two of production, shelf_life and expiry, or only expiry for the days left. Months and years are calendar months: a day that does not exist in the new month becomes its last day (31 January + 1 month = 28 February), and the answer says so. Dates are read as packs print them, GS1 dates included. An expiry given as month and year is the last day of the month, a production date given as month and year the first day (a GS1 date with day 00 stays the last day, as GS1 defines it). Optional minimum checks a minimum life left, as a share (2/3, 70%) or a time (105 days). Dates from 1900 to 2199. The tool does not know how long a product keeps.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "shelf_life_calculator"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| find | No | Optional: what to work out. Default: the one of the three that is not sent. Do not send the value of the field being found. | |
| expiry | No | The expiry or best-before date as printed: 2027-09-15, EXP 11/2027 (month and year mean the last day of the month), BBE 30.11.2027, or a GS1 date such as (17)271100 (day 00 means the last day of the month). Sent alone, it gives the days left. | |
| minimum | No | Optional minimum life left: a share (2/3, 1/2, 70%) or a time (105 days, 3 months). | |
| date_type | No | Optional GS1 AI for the printed forms: 17 expiry or use-by (default), 15 best before, 16 sell by. | |
| check_date | No | Optional, the date to count the days left from, as YYYY-MM-DD (default: today in UTC), such as the day the goods arrive. | |
| date_order | No | Optional, how to read a date with slashes such as 05/06/2026: dmy (5 June, default) or mdy (May 6). Dates with dots are always day first. Send YYYY-MM-DD to avoid the question. | |
| production | No | The production date: 2026-03-15, 15 Mar 2026, 15.03.2026, 03/15/2026 (see `date_order`) or a GS1 date such as (11)260315. Month and year only (MFG 03/2026) means the first day of the month; a GS1 date with day 00 stays the last day, as GS1 defines it. | |
| shelf_life | No | The shelf life with a unit: 540 days, 12 weeks, 18 months, 2 years, or 2 years 6 months. Whole numbers only; 1,000 and 1 000 are read as one thousand. | |
| includes_production_day | No | Optional, default false. True when the shelf life counts the production day as day 1, so the expiry is one day earlier. |