list_products
List products in a catalog by providing catalog ID. Optionally filter results, paginate, and specify fields to return.
Instructions
List products within a catalog.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog_id | Yes | Product catalog ID | |
| fields | No | Comma-separated fields to return | |
| limit | No | Number of results to return | |
| after | No | Pagination cursor for next page | |
| filter | No | JSON string of filter rules |
Implementation Reference
- src/tools/catalogs.ts:166-173 (handler)The handler function for list_products tool that calls the API to list products within a catalog.
async ({ catalog_id, ...params }) => { try { const { data, rateLimit } = await client.get(`/${catalog_id}/products`, { ...params }); return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } - src/tools/catalogs.ts:159-165 (schema)Input schema for list_products: catalog_id (required), fields, limit, after, filter (optional).
{ catalog_id: z.string().describe("Product catalog ID"), fields: z.string().optional().describe("Comma-separated fields to return"), limit: z.number().optional().default(25).describe("Number of results to return"), after: z.string().optional().describe("Pagination cursor for next page"), filter: z.string().optional().describe("JSON string of filter rules"), }, - src/tools/catalogs.ts:155-174 (registration)Registration of the list_products tool via server.tool() call, with description 'List products within a catalog.'
// ─── list_products ───────────────────────────────────────── server.tool( "list_products", "List products within a catalog.", { catalog_id: z.string().describe("Product catalog ID"), fields: z.string().optional().describe("Comma-separated fields to return"), limit: z.number().optional().default(25).describe("Number of results to return"), after: z.string().optional().describe("Pagination cursor for next page"), filter: z.string().optional().describe("JSON string of filter rules"), }, async ({ catalog_id, ...params }) => { try { const { data, rateLimit } = await client.get(`/${catalog_id}/products`, { ...params }); return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/tools/catalogs.ts:5-5 (helper)The registerCatalogTools function that registers all catalog tools including list_products on the MCP server.
export function registerCatalogTools(server: McpServer, client: AdsClient): void { - src/index.ts:71-71 (registration)Call site where registerCatalogTools is invoked to register list_products on the main server.
registerCatalogTools(server, client);