categories
Retrieve the full product type and categories map to streamline product searches. Use this data to filter results effectively with the search tool for targeted shopping experiences.
Instructions
Get the full product type/categories map. It's suggested to use this tool to get the categories and then use the search tool to search for products in a specific category.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/tools.ts:99-115 (registration)Registration of the 'categories' tool, including inline input schema ({}), description, and handler function that returns the product categories hierarchy as formatted JSON./** * Categories tool * Provides a map of product types and their associated categories. * @returns Complete product categories hierarchy */ server.tool( "categories", "Get the full product type/categories map. It's suggested to use this tool to get the categories and then use the `search` tool to search for products in a specific category.", {}, async () => { return { content: [ { type: "text" as const, text: JSON.stringify(productCategories, null, 2) } ] }; } );
- src/handlers/tools.ts:108-114 (handler)The handler function for the 'categories' tool. It imports productCategories from constants and returns it as JSON string in text content.async () => { return { content: [ { type: "text" as const, text: JSON.stringify(productCategories, null, 2) } ] }; }
- src/constants/categories.ts:6-77 (helper)Supporting constant providing the full product categories map data used by the 'categories' tool handler.export const productCategories: ProductCategoriesMap = { "giftcards": [ "all-gift-cards", "apparel", "automobiles", "cruises", "ecommerce", "electronics", "entertainment", "experiences", "flights", "food", "food-delivery", "games", "gifts", "groceries", "health-beauty", "home", "multi-brand", "music", "other", "payment-cards", "pets", "pharmacy", "restaurants", "retail", "streaming", "top-products", "travel", "utility-bills", "voip" ], "refills": [ "refill", "data", "pin", "bundles", "dth" ], "bills": [ "all-bills", "auto-loans", "banking", "bill", "catalog-sales", "cemeteries-funerals", "club-membership", "commission-businesses", "credit-card", "education", "financial-services", "healthcare", "hoa-rent", "installment-payments", "insurance", "internet-cable-tv", "mortgages-home-equity", "mortgages-property-management", "phone", "press", "sanitation", "security-monitoring", "taxes", "water-electricity-gas" ], "esims": [ "esim" ], "crypto-utils": [ "bitcoin" ] };
- src/schemas/search.ts:78-85 (schema)Zod schema and TypeScript type definition for the product categories map returned by the tool.* Product categories map schema */ export const ProductCategoriesMapSchema = z.record(z.array(z.string())); /** * Product types and their associated categories */ export type ProductCategoriesMap = z.infer<typeof ProductCategoriesMapSchema>;