Skip to main content
Glama

Returns analysis

get_returns_analysis
Read-onlyIdempotent

Why returns moved, from the refunds themselves (exact, not an estimate per product). gap splits the change in returns: total = fromEarlierOrders (refunds of orders placed before the period) + fromOrdersInSpan (orders placed in it); reading is the conclusion to state: customers_return_more (more finished months have a higher return rate than a year earlier than a lower one: name monthsWithHigherRate and any monthsWithLowerRate), earlier_sales_landing (most of the rise is refunds of earlier orders and rates are flat), both, mixed (as many months fell as rose: say it is not a clear rise), or unclear (say the data does not settle it). timing says where the refunds of each period came from: returns and refunds (their number), fromOrdersInSpan, fromEarlierOrders, earlierShare, avgDaysToRefund and byOrderMonth (the month each refunded order was placed). cohorts covers the 4 order months ending at the span's last month, each beside the same month a year earlier: sold (gross less discounts) with soldChange, returnedWithin30Days, and returnRate (returnedWithin30Days ÷ sold in both years, with changePoints). A cohort's rate going up means customers really return more; a flat rate with higher returns means refunds of bigger earlier sales landed in this period. mature false = that month's 30 days have not passed, so its rate can still rise: say so and do not conclude from it. Use whenever returns are part of the answer. 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 default period (the one on the operator's screen, else the last 30 days), which is not that month. When the operator names no period, send neither.

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": "get_returns_analysis"
  }
}

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 period: the one on the operator's screen when the message names it, else the last 30 days.
fromNoFirst day of the span, inclusive, as YYYY-MM-DD. Send together with `to`, or omit both to read the default period: the one on the operator's screen when the message names it, else the last 30 days.
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).
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
    • changedInput schema / properties / from / description
      Previous value: -"First day of the span, inclusive, as YYYY-MM-DD. Send together with `to`, or omit both to read the default 30-day period."New value: +"First day of the span, inclusive, as YYYY-MM-DD. Send together with `to`, or omit both to read the default period: the one on the operator's screen when the message names it, else the last 30 days."
    • changedInput schema / properties / to / description
      Previous value: -"Last 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."New value: +"Last day of the span, inclusive, as YYYY-MM-DD; not after today. Send together with `from`, or omit both to read the default period: the one on the operator's screen when the message names it, else the last 30 days."
  2. Added

TDQS

A4.3/5.0
Behavior5/5

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

Annotations only cover the safety profile (readOnly, idempotent, closed-world), so the description carries the real load — and it does: it discloses the exact fields returned (gap, total, fromEarlierOrders, fromOrdersInSpan, reading, timing, cohorts) and how to interpret them. It also warns about the mature=false case where a partial 30-day window makes a rate provisional, which is genuine behavioral context an agent could not infer from the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded, but the body is one dense run-on paragraph with deep parenthetical nesting ('mature false = that month's 30 days have not passed...'), which makes the interpretation keys hard to scan. Nearly all the content is useful for reading the output, but it would earn more as a structured list.

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?

With no output schema and a genuinely complex analytical payload, the description supplies the return shape, the meaning of each field, and the decision rules for translating them into a conclusion. An agent has enough to call the tool and interpret the response correctly.

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 both date parameters are already fully documented in the schema, including the both-or-neither and default-period rules. The prose repeats the from/to semantics and says nothing about `compare` or `salesChannel`, so it adds little beyond what the schema provides; baseline 3 applies.

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?

Opens with a specific verb and resource — 'Why returns moved, from the refunds themselves' — and immediately scopes it against the alternative method ('exact, not an estimate per product'). An agent can tell this is a causal returns-decomposition tool rather than a product-level return estimate.

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

Usage Guidelines4/5

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

Gives a clear trigger ('Use whenever returns are part of the answer') and strong exclusion logic for the period: a named month, week or two explicit dates MUST be sent to this tool, and when no period is named, send neither. It never names a sibling alternative to route away to, which keeps it just below a 5.

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