Skip to content

Catalog: ships_from as a list + cursor pagination on search - #15

Merged
joerj123 merged 1 commit into
mainfrom
catalog-ships-from-list-and-pagination
Jun 11, 2026
Merged

Catalog: ships_from as a list + cursor pagination on search#15
joerj123 merged 1 commit into
mainfrom
catalog-ships-from-list-and-pagination

Conversation

@joerj123

Copy link
Copy Markdown
Collaborator

What & why

Two catalog changes:

1. ships_from scalar → list (required fix)

The Global UCP catalog changed filters.ships_from from a single { country } object to a list of origin objects (shop/world#796951). The endpoint now rejects the old scalar shape:

The property '#/catalog/filters/ships_from' of type object did not match the following type: array

So the CLI's current --ships-from is broken until this lands.

  • filters.ships_from is now sent as [{ country }, ...] (origins OR together).
  • --ships-from accepts a comma-separated ISO2 list, e.g. --ships-from US,CA.

2. Cursor pagination on shop search

  • New --cursor flag forwards pagination.cursor alongside limit.
  • Each search response footer surfaces the next-page cursor + estimated total when more results exist; re-run the same query/filters with --cursor <cursor> to walk pages (no duplicates, steady totals).
  • --limit still allows up to 50 (the API max), but it's not recommended — large pages burn tokens. Guidance/help nudge toward small pages (6-8).

Docs (SKILL.md, references/catalog-mcp.md) updated; SKILL.md edits kept ~token-neutral.

Testing

Unit tests: pnpm typecheck && pnpm build && pnpm test85 pass / 0 fail (5 new: ships_from list, cursor forwarding, CLI flag mapping, pagination footer render x2).

Manual testing against the live catalog (catalog.shopify.com):

Direct API

  • ships_from: [{country:"US"},{country:"CA"}] → 200, returns products + pagination block. ✅
  • Page 2 via returned cursor → distinct products, advanced offset, stable total. ✅
  • Old scalar ships_from: {country:"US"}rejected (confirms the migration). ✅

CLI (--memory-store, unauthenticated)

  • shop search "coffee mug" --ships-from US,CA --ships-to US --limit 3 → real results + footer cursor. ✅
  • Re-run with --cursor <token> → page 2, no overlap with page 1. ✅
  • --limit 50 → 50 results; --limit 51 → rejected (expected 1-50). ✅

The Global UCP catalog changed filters.ships_from from a single
{ country } object to a list of origin objects (shop/world#796951).
The API now rejects the old scalar shape, so this is a required fix.

- shop-client: send filters.ships_from as [{ country }, ...] (OR'd);
  --ships-from now takes a comma-separated ISO2 list (e.g. US,CA).
- search: add a --cursor flag and forward pagination.cursor alongside
  limit. Each search response footer surfaces the next-page cursor and
  estimated total when more results exist; re-run the same query with
  --cursor to walk pages.
- --limit still allows up to 50, but guidance favours small pages.
- Docs (SKILL.md, catalog-mcp.md) and tests updated.
@joerj123
joerj123 force-pushed the catalog-ships-from-list-and-pagination branch from 612f515 to 0d8c356 Compare June 11, 2026 20:19
@joerj123
joerj123 merged commit 2e15cac into main Jun 11, 2026
1 check passed
@PawanP1808
PawanP1808 deleted the catalog-ships-from-list-and-pagination branch June 15, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant