Skip to main content
Glama

listProducts

Retrieve paginated product lists from the Omnisend catalog to manage and access product information with cursor-based navigation.

Instructions

Retrieve a list of products from the Omnisend catalog with pagination support. The response includes pagination information (next/previous cursor, limit, offset).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that executes the listProducts tool. It calls the imported listProducts helper from api-resources, applies product field filtering, formats the response as MCP content with JSON text, and handles errors.
    async (args) => { try { const response = await listProducts(args); // Filter products data to include only defined fields const filteredProducts = response.products.map(filterProductFields); return { content: [ { type: "text", text: JSON.stringify({ products: filteredProducts, paging: response.paging }, null, 2) } ] }; } catch (error) { if (error instanceof Error) { return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } return { content: [{ type: "text", text: "An unknown error occurred" }] }; } }
  • JSON Schema defining the input parameters for the listProducts tool, including pagination, status, vendor, date filters, categories, and tags.
    { additionalProperties: false, properties: { limit: { description: "Maximum number of products to return", type: "number" }, offset: { description: "Skip first N results", type: "number" }, status: { description: "Filter products by status", enum: ["active", "draft", "archived"], type: "string" }, vendor: { description: "Filter products by vendor/brand", type: "string" }, createdAfter: { description: "Filter products created after specified date (ISO format)", type: "string" }, updatedAfter: { description: "Filter products updated after specified date (ISO format)", type: "string" }, categories: { description: "Filter products by categories", items: { type: "string" }, type: "array" }, tags: { description: "Filter products by tags", items: { type: "string" }, type: "array" } }, type: "object" },
  • The server.tool call that registers the listProducts tool with the MCP server, specifying name, description, input schema, and handler.
    server.tool( "listProducts", "Retrieve a list of products from the Omnisend catalog with pagination support. The response includes pagination information (next/previous cursor, limit, offset).", { additionalProperties: false, properties: { limit: { description: "Maximum number of products to return", type: "number" }, offset: { description: "Skip first N results", type: "number" }, status: { description: "Filter products by status", enum: ["active", "draft", "archived"], type: "string" }, vendor: { description: "Filter products by vendor/brand", type: "string" }, createdAfter: { description: "Filter products created after specified date (ISO format)", type: "string" }, updatedAfter: { description: "Filter products updated after specified date (ISO format)", type: "string" }, categories: { description: "Filter products by categories", items: { type: "string" }, type: "array" }, tags: { description: "Filter products by tags", items: { type: "string" }, type: "array" } }, type: "object" }, async (args) => { try { const response = await listProducts(args); // Filter products data to include only defined fields const filteredProducts = response.products.map(filterProductFields); return { content: [ { type: "text", text: JSON.stringify({ products: filteredProducts, paging: response.paging }, null, 2) } ] }; } catch (error) { if (error instanceof Error) { return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } return { content: [{ type: "text", text: "An unknown error occurred" }] }; } } );
  • Supporting helper function that performs the HTTP GET request to the Omnisend '/products' API endpoint with query params and returns the ProductsResponse.
    export const listProducts = async (params: ListProductsParams = {}): Promise<ProductsResponse> => { try { const response = await omnisendApi.get<ProductsResponse>('/products', { params }); return response.data; } catch (error) { if (error instanceof Error) { throw new Error(`Error getting products list: ${error.message}`); } else { throw new Error('Unknown error occurred when getting products list'); } } };

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/plutzilla/omnisend-mcp'

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