Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
catalog_idYesProduct catalog ID
fieldsNoComma-separated fields to return
limitNoNumber of results to return
afterNoPagination cursor for next page
filterNoJSON string of filter rules

Implementation Reference

  • 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 };
      }
    }
  • 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"),
    },
  • 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 };
        }
      }
    );
  • 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);

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description provides minimal behavioral detail beyond the action. It does not mention pagination, filtering capabilities, response structure, or any operational considerations. With no annotations, the agent is left without information about rate limits, access requirements, or the potential size of response.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that efficiently states the core function. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with five parameters and no annotations, the description is under-specifying. It fails to mention pagination (after/limit), filtering (filter), and field selection (fields), all of which are key behaviors. It also does not explain the return format, which is especially important without an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema documents all five parameters, so the description adds no additional semantic value. It does reinforce the meaning of catalog_id by noting the products are within a catalog, but this is directly derivable from the parameter name and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'list' and specifies the resource 'products within a catalog', clearly distinguishing it from sibling tools like get_product (single product) and list_catalogs. It leaves no ambiguity about the tool's function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit usage guidance is provided. The description implies it is for enumerating products in a catalog, but does not explicitly contrast with get_product or mention when not to use it. The agent must infer this from the schema and sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools