Skip to main content
Glama

Compare sales between periods

compare_sales
Read-onlyIdempotent

Shopify's sales breakdown (gross sales, discounts, returns, net sales, total sales, orders) for a span AND its comparison period, line by line with change and changePct, already worked out; compared with the days before, sameTimeLastYear also gives the same dates a year ago, so a seasonal fall shows — the tool for 'why did sales fall', 'what happened against last year', 'compare these weeks with the same weeks last year'. netSalesGap splits the change in net sales into fromGrossSales, fromDiscounts and fromReturns (they add up to the total; negative = that part pulled net sales down) with each part's share of the gap; returnsShareOfGross gives returns ÷ gross in both periods and the change in points; grossPerOrder is gross sales per order; refunds is the NUMBER of refunds issued; traffic gives sessions and the site's conversion rate in both periods (null = no traffic source); customers gives new customers, returning customers and returning customers' orders in both periods. byWeek adds the same per 7-day week, plus lossDays (days whose net sales were below zero: refunds above sales) and weakestDays (the three lowest days). Shares of the gap can add up to more than 100% when discounts moved the other way: say so. grossDrivers (online) splits the change in gross sales into trafficEffect, conversionEffect and valuePerOrderEffect, which add up to grossChange: quote them to say whether fewer people came, fewer bought or each order was worth less. headline is the diagnosis's opening table, already in order: render EVERY row (translate the line names; a rate row's change is in points). These are the store's sales-ladder totals: get_sales_by's product-line netSales can differ by a few euros — quote this tool for store totals. Quote these figures: never subtract the two periods yourself. Returns count in the period the refund was issued, not the period of the order — say so when returns drive the change. complete false = some orders lack the figures and every line understates. Optional from and to (inclusive YYYY-MM-DD, both or neither, never after today) read another span instead of the default period. A named month, a week or two dates the operator gave MUST be sent here: without them this reads the last 30 days, which is not that month.

Input Schema

NameRequiredDescriptionDefault
toNoLast day of the span, inclusive, as YYYY-MM-DD; not after today. Send together with `from`, or omit both to read the default 30-day period.
fromNoFirst day of the span, inclusive, as YYYY-MM-DD. Send together with `to`, or omit both to read the default 30-day period.
byWeekNoAlso split the span into 7-day weeks from its first day (start the span on a Monday for natural weeks), each compared with the same week of the comparison period. Up to 13 weeks.
compareNoWhat to compare the span with: previous (default, the same number of days just before), yoy (the same dates last year) or yoyWeekday (52 weeks back, the same weekdays — use it for natural Monday–Sunday weeks or whenever the operator says 'last year' over weeks).
compareToNoLast day of the named comparison period, YYYY-MM-DD.
compareFromNoFirst day of a NAMED comparison period, YYYY-MM-DD, with compareTo. For 'September with October': from/to October, compareFrom/compareTo the whole of September. Takes the place of compare.
salesChannelNoOnly online orders (the web shop) or only point-of-sale orders; omit for every channel. When the operator says 'solo web', 'online only' or 'sin POS', send online — and keep sending it for the rest of the conversation.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / compareFrom
      Added value: +{
      +  "description": "First day of a NAMED comparison period, YYYY-MM-DD, with compareTo. For 'September with October': from/to October, compareFrom/compareTo the whole of September. Takes the place of compare.",
      +  "format": "date",
      +  "type": "string"
      +}
    • addedInput schema / properties / compareTo
      Added value: +{
      +  "description": "Last day of the named comparison period, YYYY-MM-DD.",
      +  "format": "date",
      +  "type": "string"
      +}
  2. Added

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the read-only annotations, the description discloses substantial behavior: the exact breakdown fields, how netSalesGap decomposes, that shares can exceed 100%, that returns count in the refund-issued period, that complete=false understates lines, and what null traffic means. It also explains byWeek extras like lossDays and weakestDays, grossDrivers effects, and the headline table's row rendering. This is far richer than the annotations and materially helps correct invocation and interpretation.

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 front-loaded with the core purpose and every major caveat, and most sentences carry operational weight rather than filler. However, it is a dense run-on paragraph with long clauses, making it harder to scan than a bulleted breakdown of metrics and caveats would be. It is appropriately sized for a complex analytics tool but not maximally concise in presentation.

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?

Given seven parameters, no output schema, and a complex multi-metric comparison payload, the description is complete enough to call and interpret the tool correctly. It covers defaults, date constraints, comparison modes, named comparison periods, sales channel scoping, weekly breakdown behavior, output field meanings, and important caveats like returns timing and complete=false. Nothing critical for correct use is missing.

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 description coverage is 100%, so the baseline is 3, but the description adds operational meaning beyond the schema: it explains the default 30-day behavior when from/to are omitted, requires both dates together, and gives a concrete mapping example for a named comparison ('September with October': from/to October, compareFrom/compareTo September). It also reinforces salesChannel persistence and yoyWeekday guidance for natural weeks. Some of this repeats schema text, so it is strong but not fully additive.

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 states a specific verb and resource: comparing Shopify sales breakdowns between a span and its comparison period, line by line with change and changePct. It distinguishes itself from the sibling get_sales_by by saying that product-line netSales can differ and that this tool should be quoted for store totals. It also names concrete use cases such as 'why did sales fall' and 'compare these weeks with the same weeks last year'.

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?

It explicitly says when to use this tool, including comparative diagnosis and year-over-year questions, and when to prefer get_sales_by. It gives a hard usage constraint: a named month, week, or two dates supplied by the operator MUST be sent here, because without them the tool reads the last 30 days instead of that named period. It also explains that salesChannel should persist once the operator says 'online only'.

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