search_products
Find products in the Hybris catalog by entering a search query, with options to control pagination for browsing results.
Instructions
Search for products in the Hybris catalog using a query string
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for products | |
| pageSize | No | Number of results per page (default: 20) | |
| currentPage | No | Page number to retrieve (0-indexed, default: 0) |
Implementation Reference
- src/index.ts:293-299 (handler)MCP tool dispatch handler for 'search_products' that calls HybrisClient.searchProducts with parsed argumentscase 'search_products': result = await hybrisClient.searchProducts( args?.query as string, args?.pageSize as number, args?.currentPage as number ); break;
- src/hybris-client.ts:340-351 (handler)Core implementation of searchProducts method that performs REST API call to Hybris OCC /products/search endpointasync searchProducts(query: string, pageSize = 20, currentPage = 0): Promise<ProductSearchResult> { const params = new URLSearchParams({ query, pageSize: pageSize.toString(), currentPage: currentPage.toString(), fields: 'products(code,name,description,price,stock,categories,images),pagination', }); return this.request<ProductSearchResult>( `/rest/v2/${this.config.baseSiteId}/products/search?${params}` ); }
- src/index.ts:39-62 (schema)Tool definition including name, description, and input schema for search_products{ name: 'search_products', description: 'Search for products in the Hybris catalog using a query string', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for products', }, pageSize: { type: 'number', description: 'Number of results per page (default: 20)', }, currentPage: { type: 'number', description: 'Page number to retrieve (0-indexed, default: 0)', }, }, required: ['query'], }, }, { name: 'get_product',
- src/hybris-client.ts:15-23 (schema)TypeScript interface defining the output structure ProductSearchResult returned by searchProductsexport interface ProductSearchResult { products: Product[]; pagination: { currentPage: number; pageSize: number; totalPages: number; totalResults: number; }; }
- src/index.ts:281-283 (registration)Registration of tool list handler that exposes search_products in the available tools listserver.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });