Skip to main content
Glama

EAN Check barcode tools

shelf_life_calculator

Read-onlyIdempotent

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

NameRequiredDescriptionDefault
findNoOptional: what to work out. Default: the one of the three that is not sent. Do not send the value of the field being found.
expiryNoThe 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.
minimumNoOptional minimum life left: a share (2/3, 1/2, 70%) or a time (105 days, 3 months).
date_typeNoOptional GS1 AI for the printed forms: 17 expiry or use-by (default), 15 best before, 16 sell by.
check_dateNoOptional, the date to count the days left from, as YYYY-MM-DD (default: today in UTC), such as the day the goods arrive.
date_orderNoOptional, 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.
productionNoThe 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_lifeNoThe 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_dayNoOptional, default false. True when the shelf life counts the production day as day 1, so the expiry is one day earlier.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, closed-world behavior, so the burden here is on computation semantics, and the description delivers: calendar-month clamping with a worked example, month/year-only forms resolving to last-day or first-day, GS1 day-00 handled per GS1, and a supported date range of 1900-2199. What it omits is the shape of the answer (which fields come back, where the 'answer says so' adjustment note appears).

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 description is long but front-loaded: the operation and the 'send two of three' contract come first, then the interpretation rules, then the minimal optional checks. Some content duplicates the schema's field descriptions (GS1 day 00, month/year conventions appear in both places), which is the main cost, but no sentence is filler.

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?

For a 9-parameter calculator with no output schema, the definition covers input combinations, date parsing, month arithmetic, the minimum-life check and the date range, which is nearly everything an agent needs. The remaining gap is return-value description: with no output schema, the description should state what comes back beyond the computed date, such as the clamp notice and any minimum-life verdict.

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 a 3 is the floor, and the description earns above that by adding the cross-parameter rule (send two of three, never the target) and the month/year interpretation conventions that govern how `expiry` and `production` strings are read. It adds modest meaning beyond the schema rather than a large amount, since the schema's own field descriptions already cover formats and GS1 examples.

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 opening sentence names the exact operation: derive any one of expiry, production or shelf life from the other two, plus remaining life at a check date. It cleanly separates the tool from siblings like parse_gs1 or julian_date, which parse or convert dates rather than compute a missing leg of the shelf-life triangle.

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

Usage Guidelines5/5

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

Invocation conditions are stated as a hard rule: send two of `production`, `shelf_life`, `expiry`, or only `expiry` for days left, and explicitly do not send the field being found. It also sets a scope boundary with 'The tool does not know how long a product keeps,' telling the agent this is arithmetic, not a product database lookup, so it need not consult a sibling.

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.

Resources