Skip to main content
Glama

Shopify Storefront MCP Server

input-schemas.ts4.8 kB
import z from "zod"; // ** ** ** Common schemas ** ** ** // export const StoreIdInput = z .enum(["id1", "id2", "id3"]) .describe("Store identifier: id1 (The Perfume Shop), id2 (Perfumes Club), id3 (Perfumes & Co)"); // ** ** ** Product-related schemas ** ** ** // export const FindProductsInput = z.object({ storeId: StoreIdInput, query: z.string().optional().describe("The search query string."), after: z .string() .optional() .describe("Cursor for pagination (from previous pageInfo.endCursor)."), sortKey: z .enum([ "RELEVANCE", "TITLE", "PRICE", "CREATED_AT", "UPDATED_AT", "BEST_SELLING", "PRODUCT_TYPE", "VENDOR", ]) .optional() .default("RELEVANCE") .describe( "Sort by relevance, title, price, created at, updated at, best selling, product type, or vendor.", ), reverse: z .boolean() .optional() .default(false) .describe("Reverse the sort order."), }); export const FindProductsInputShape = FindProductsInput.shape; export const GetProductByIdInput = z.object({ storeId: StoreIdInput, productId: z .string() .describe("The GID of the product (e.g., 'gid://shopify/Product/123')."), includeVariants: z .boolean() .optional() .default(true) .describe("Whether to include product variants."), variantCount: z .number() .int() .positive() .optional() .default(5) .describe("Maximum number of variants to return."), includeImages: z .boolean() .optional() .default(false) .describe("Return first image URL (75px)?"), }); export const GetProductByIdInputShape = GetProductByIdInput.shape; // ** ** ** Cart-related schemas ** ** ** // export const CartLineInput = z .object({ merchandiseId: z.string().describe("The GID of the product variant."), quantity: z .number() .int() .positive() .describe("The quantity of the variant."), attributes: z .array(z.object({ key: z.string(), value: z.string() })) .optional() .describe("Custom attributes for the line item."), }) .describe("Input for a single cart line item."); export const CartLineInputShape = CartLineInput.shape; export const CartBuyerIdentityInput = z .object({ email: z.string().email().optional(), phone: z.string().optional(), countryCode: z .string() .length(2) .optional() .describe("ISO 3166-1 alpha-2 country code."), }) .describe("Input for buyer identity information."); export const CartBuyerIdentityInputShape = CartBuyerIdentityInput.shape; export const AttributeInput = z .object({ key: z.string(), value: z.string(), }) .describe("Input for a custom cart attribute."); export const AttributeInputShape = AttributeInput.shape; export const CartLineUpdateInput = z .object({ id: z.string().describe("The GID of the cart line to update."), quantity: z .number() .int() .nonnegative() .describe("The new quantity (0 to remove)."), merchandiseId: z .string() .optional() .describe("Optional: New variant GID if changing the variant."), attributes: z .array(z.object({ key: z.string(), value: z.string() })) .optional() .describe("Optional: New custom attributes."), }) .describe("Input for updating a single cart line item."); export const CartLineUpdateInputShape = CartLineUpdateInput.shape; // Cart operation schemas with storeId export const CartCreateInput = z.object({ storeId: StoreIdInput, lines: z .array(CartLineInput) .optional() .describe("Initial line items to add to the cart."), buyerIdentity: CartBuyerIdentityInput.optional().describe( "Information about the buyer.", ), attributes: z .array(AttributeInput) .optional() .describe("Custom attributes for the cart."), }); export const CartCreateInputShape = CartCreateInput.shape; export const CartLinesAddInput = z.object({ storeId: StoreIdInput, cartId: z.string().describe("The GID of the cart to modify."), lines: z.array(CartLineInput).min(1).describe("Line items to add."), }); export const CartLinesAddInputShape = CartLinesAddInput.shape; export const CartLinesUpdateInput = z.object({ storeId: StoreIdInput, cartId: z.string().describe("The GID of the cart to modify."), lines: z .array(CartLineUpdateInput) .min(1) .describe("Line items to update."), }); export const CartLinesUpdateInputShape = CartLinesUpdateInput.shape; export const CartLinesRemoveInput = z.object({ storeId: StoreIdInput, cartId: z.string().describe("The GID of the cart to modify."), lineIds: z .array(z.string()) .min(1) .describe("Array of cart line GIDs to remove."), }); export const CartLinesRemoveInputShape = CartLinesRemoveInput.shape; export const GetCartInput = z.object({ storeId: StoreIdInput, cartId: z.string().describe("The GID of the cart to fetch."), }); export const GetCartInputShape = GetCartInput.shape;

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/volticscontent/axios_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server