Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/catalogs-shopper-catalog-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@epcc-sdk/sdks-catalogs": minor
---

`@epcc-sdk/sdks-catalogs` now includes the 16 shopper catalog operations under `/catalog`, the reads a storefront makes, chosen by catalog rules from the shopper's context: `getByContextRelease`, the `getByContext*` hierarchy, node and product reads, and `configureByContextProduct`. Each has an SDK function and an MCP tool, so `tools()` now returns 46. Nothing existing changes.
15 changes: 9 additions & 6 deletions packages/sdks/catalogs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
A TypeScript client for the Elastic Path admin catalogs API. It is generated from the API
specification, so the request and response types match the API.

This is the authoring side of catalogs: create and update catalogs and catalog rules, publish
releases, and read the hierarchies, nodes and products inside a release. It covers the 30
operations under `/catalogs`. It is not the shopper catalog: the `/catalog/*` browsing
operations a storefront calls live in `@epcc-sdk/sdks-shopper`.
It covers both sides of the catalog view service:

- The authoring side, the 30 operations under `/catalogs`: create and update catalogs and catalog
rules, publish releases, and read the hierarchies, nodes and products inside a release.
- The shopper side, the 16 operations under `/catalog`: read the release, hierarchies, nodes and
products that the shopper's context selects through catalog rules, and configure a bundle.
`@epcc-sdk/sdks-shopper` has the same operations, with its browser authentication.

## Installation

Expand Down Expand Up @@ -169,13 +172,13 @@ import { zCatalogCreateData } from "@epcc-sdk/sdks-catalogs/zod"

## MCP endpoint tools

The `/mcp` subpath turns each of the 30 catalogs operations into a Model Context Protocol (MCP)
The `/mcp` subpath turns each of the 46 catalogs operations into a Model Context Protocol (MCP)
tool. The main entry imports none of it. `zod` 4 and `@modelcontextprotocol/sdk` are needed only
for this subpath.

Each operation has one tool factory, named after its function with `Tool` added, such as
`getCatalogsTool`. A factory returns `{ name, config, handler }`, the three arguments that
`McpServer.registerTool` takes. `tools()` returns all 30 in operation order. A handler returns an
`McpServer.registerTool` takes. `tools()` returns all 46 in operation order. A handler returns an
API error as an `isError` result and does not throw.

Register one tool:
Expand Down
100 changes: 100 additions & 0 deletions packages/sdks/catalogs/src/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts

export {
configureByContextProduct,
createCatalog,
createRule,
deleteCatalogById,
Expand All @@ -11,6 +12,21 @@ export {
getAllNodes,
getAllProducts,
getAllRelatedProducts,
getByContextAllHierarchies,
getByContextAllNodes,
getByContextAllProducts,
getByContextAllRelatedProducts,
getByContextChildNodes,
getByContextChildProducts,
getByContextComponentProductIds,
getByContextHierarchy,
getByContextHierarchyChildNodes,
getByContextHierarchyNodes,
getByContextNode,
getByContextProduct,
getByContextProductsForHierarchy,
getByContextProductsForNode,
getByContextRelease,
getCatalogById,
getCatalogs,
getChildNodes,
Expand Down Expand Up @@ -39,18 +55,26 @@ export type {
Amount,
AvailablePrices,
BundleConfiguration,
BundleConfigurationData,
BundleConfigurationData2,
Catalog,
CatalogCreateData,
CatalogData,
CatalogListData,
CatalogReleaseCreateData,
CatalogRuleValidatorRequest,
CatalogUpdateData,
Channel,
ClientOptions,
ComponentProduct,
ComponentProductOption,
ComponentProductsRelationship,
Components,
ConfigureByContextProductData,
ConfigureByContextProductError,
ConfigureByContextProductErrors,
ConfigureByContextProductResponse,
ConfigureByContextProductResponses,
CreateCatalogData,
CreateCatalogError,
CreateCatalogErrors,
Expand Down Expand Up @@ -122,6 +146,81 @@ export type {
GetAllRelatedProductsErrors,
GetAllRelatedProductsResponse,
GetAllRelatedProductsResponses,
GetByContextAllHierarchiesData,
GetByContextAllHierarchiesError,
GetByContextAllHierarchiesErrors,
GetByContextAllHierarchiesResponse,
GetByContextAllHierarchiesResponses,
GetByContextAllNodesData,
GetByContextAllNodesError,
GetByContextAllNodesErrors,
GetByContextAllNodesResponse,
GetByContextAllNodesResponses,
GetByContextAllProductsData,
GetByContextAllProductsError,
GetByContextAllProductsErrors,
GetByContextAllProductsResponse,
GetByContextAllProductsResponses,
GetByContextAllRelatedProductsData,
GetByContextAllRelatedProductsError,
GetByContextAllRelatedProductsErrors,
GetByContextAllRelatedProductsResponse,
GetByContextAllRelatedProductsResponses,
GetByContextChildNodesData,
GetByContextChildNodesError,
GetByContextChildNodesErrors,
GetByContextChildNodesResponse,
GetByContextChildNodesResponses,
GetByContextChildProductsData,
GetByContextChildProductsError,
GetByContextChildProductsErrors,
GetByContextChildProductsResponse,
GetByContextChildProductsResponses,
GetByContextComponentProductIdsData,
GetByContextComponentProductIdsError,
GetByContextComponentProductIdsErrors,
GetByContextComponentProductIdsResponse,
GetByContextComponentProductIdsResponses,
GetByContextHierarchyChildNodesData,
GetByContextHierarchyChildNodesError,
GetByContextHierarchyChildNodesErrors,
GetByContextHierarchyChildNodesResponse,
GetByContextHierarchyChildNodesResponses,
GetByContextHierarchyData,
GetByContextHierarchyError,
GetByContextHierarchyErrors,
GetByContextHierarchyNodesData,
GetByContextHierarchyNodesError,
GetByContextHierarchyNodesErrors,
GetByContextHierarchyNodesResponse,
GetByContextHierarchyNodesResponses,
GetByContextHierarchyResponse,
GetByContextHierarchyResponses,
GetByContextNodeData,
GetByContextNodeError,
GetByContextNodeErrors,
GetByContextNodeResponse,
GetByContextNodeResponses,
GetByContextProductData,
GetByContextProductError,
GetByContextProductErrors,
GetByContextProductResponse,
GetByContextProductResponses,
GetByContextProductsForHierarchyData,
GetByContextProductsForHierarchyError,
GetByContextProductsForHierarchyErrors,
GetByContextProductsForHierarchyResponse,
GetByContextProductsForHierarchyResponses,
GetByContextProductsForNodeData,
GetByContextProductsForNodeError,
GetByContextProductsForNodeErrors,
GetByContextProductsForNodeResponse,
GetByContextProductsForNodeResponses,
GetByContextReleaseData,
GetByContextReleaseError,
GetByContextReleaseErrors,
GetByContextReleaseResponse,
GetByContextReleaseResponses,
GetCatalogByIdData,
GetCatalogByIdError,
GetCatalogByIdErrors,
Expand Down Expand Up @@ -256,6 +355,7 @@ export type {
Schedule,
SelfLink,
ShopperAttributes,
Tag,
Tier,
TieredAmount,
TieredCurrencies,
Expand Down
Loading