Skip to main content
Glama

get_cart_affinity

Co-purchase / market-basket analysis. Given an anchor product (productTitle), returns other products frequently bought with it, ranked by lift. Reports: basket (same-order co-purchase — best for bundles, 'frequently bought together' widgets, post-checkout upsells), lifetime (same-customer across all their orders — best for email flows and longer-horizon recommendations; also returns avgDaysToCoBuy for sequencing). Each pair has support, confidence, lift (>3 strong, 1.5–3 moderate, <1.5 weak), and a verdict. Co-occurrences below minCoOccurrences are suppressed because lift is unstable on small samples.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of co-products to return (default: 10, max: 25).
reportYesbasket = same-order co-purchase; lifetime = same-customer across orders.
_offsetNoPagination offset. If a response includes _pagination.hasMore=true, use _offset to fetch the next page.
endDateNoEnd date (YYYY-MM-DD). Defaults to yesterday (last fully-closed day — today is excluded by default to avoid partial-day totals; pass an explicit endDate to include today).
startDateNoStart date (YYYY-MM-DD). Defaults to a 30-day window ending yesterday. For lifetime: bounds anchor acquisition; candidate purchases are looked up across the customer's full history.
productTitleYesAnchor product title (case-insensitive substring match). Required.
minCoOccurrencesNoSuppress pairs with fewer than this many co-occurrences (default: 3). Raise to 5–10 for high-volume stores; lower to 2 for low-volume stores or specific anchor products.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. Added

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses ranking by lift, lift interpretation bands, the per-pair metrics returned, and the suppression rule for low co-occurrence counts with the rationale (lift instability on small samples). It omits auth/permission or rate-limit context, but the behavioral disclosures are substantive.

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?

Front-loaded with the core purpose and then the two report modes; dense but every clause carries information an agent needs. Slightly long but no filler sentences.

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?

No output schema exists, yet the description enumerates the returned fields (support, confidence, lift, verdict, avgDaysToCoBuy) and their interpretation, filling the gap. Combined with 100% schema coverage for inputs, it is complete for correct invocation.

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 the baseline is 3. The description adds meaning beyond the schema by explaining how to read lift values (>3 strong, <1.5 weak) and why minCoOccurrences matters, which enriches the agent's interpretation of those parameters.

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?

States a specific analysis (co-purchase/market-basket), the required input (productTitle anchor), and the output (other products ranked by lift). It clearly separates the two report modes so an agent can distinguish basket vs lifetime without ambiguity.

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 explicit when-to-use guidance per report mode: basket for bundles, 'frequently bought together' widgets, and post-checkout upsells; lifetime for email flows and longer-horizon recommendations. It does not name a sibling alternative or state exclusions, but the contextual routing is strong.

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