Skip to main content
Glama

search_products

Search for products in the SAP Commerce Cloud catalog using a query string, with options to control pagination for result management.

Instructions

Search for products in the Hybris catalog using a query string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for products
pageSizeNoNumber of results per page (default: 20)
currentPageNoPage number to retrieve (0-indexed, default: 0)

Implementation Reference

  • The `searchProducts` method in the `HybrisClient` class performs the API request to retrieve product search results from the Hybris OCC API.
    async 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>(
        `/occ/v2/${encodeURIComponent(this.config.baseSiteId!)}/products/search?${params}`
      );
    }
  • src/index.ts:104-125 (registration)
    The `search_products` tool is registered in the `tools` array definition.
    {
      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'],
      },
    },
  • The `CallToolRequestSchema` handler calls the `hybrisClient.searchProducts` method when the tool `search_products` is requested.
    case 'search_products':
      result = await hybrisClient.searchProducts(
        validateString(args, 'query', true),
        validateNumber(args, 'pageSize', { min: 1, max: 100 }),
        validateNumber(args, 'currentPage', { min: 0 })
      );
      break;

Latest Blog Posts

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/mcieunic/hybris-mcp-main'

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