Skip to main content
Glama
amir-bengherbi

Shopify MCP Server

get-customers

Retrieve Shopify customer data with pagination support to manage and analyze store client information systematically.

Instructions

Get shopify customers with pagination support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoLimit of customers to return
nextNoNext page cursor

Implementation Reference

  • src/index.ts:218-241 (registration)
    Registration of the 'get-customers' MCP tool, including Zod input schema for parameters (limit, next) and inline async handler function that instantiates ShopifyClient and calls loadCustomers, returning JSON response or error.
    server.tool(
      "get-customers",
      "Get shopify customers with pagination support",
      {
        limit: z.number().optional().describe("Limit of customers to return"),
        next: z.string().optional().describe("Next page cursor"),
      },
      async ({ limit, next }) => {
        const client = new ShopifyClient();
        try {
          const response = await client.loadCustomers(
            SHOPIFY_ACCESS_TOKEN,
            MYSHOPIFY_DOMAIN,
            limit,
            next
          );
          return {
            content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
          };
        } catch (error) {
          return handleError("Failed to retrieve customers data", error);
        }
      }
    );
  • Zod schema defining input parameters for the get-customers tool: optional limit (number) and next page cursor (string).
      limit: z.number().optional().describe("Limit of customers to return"),
      next: z.string().optional().describe("Next page cursor"),
    },
  • Core implementation of customer loading via Shopify Admin API REST endpoint /customers.json, supporting pagination with limit and page_info, selecting fields id/email/tags, and parsing next page cursor from Link header.
    async loadCustomers(
      accessToken: string,
      shop: string,
      limit?: number,
      next?: string
    ): Promise<LoadCustomersResponse> {
      const res = await this.shopifyHTTPRequest<{ customers: any[] }>({
        method: "GET",
        url: `https://${shop}/admin/api/${this.SHOPIFY_API_VERSION}/customers.json`,
        accessToken,
        params: {
          limit: limit ?? 250,
          page_info: next,
          fields: ["id", "email", "tags"].join(","),
        },
      });
    
      const customers = res.data.customers;
      const nextPageInfo = ShopifyClient.getShopifyOrdersNextPage(
        res.headers.get("link")
      );
    
      return { customers, next: nextPageInfo };
    }
  • Type definition for the output of loadCustomers: array of ShopifyCustomer objects with optional next pagination cursor.
    export type LoadCustomersResponse = {
      customers: Array<ShopifyCustomer>;
      next?: string | undefined;
    };
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'pagination support' which hints at behavior for large result sets, but fails to disclose critical details: whether this is a read-only operation, what permissions are required, rate limits, error conditions, or the format of returned data. For a tool with no annotations, this leaves significant behavioral gaps.

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, efficient sentence with zero waste. It's front-loaded with the core purpose and includes a key behavioral hint (pagination). Every word earns its place.

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?

Given no annotations and no output schema, the description is incomplete for a data retrieval tool. It doesn't explain what data is returned (e.g., customer fields), how pagination works in practice, or error handling. For a tool with 2 parameters and complex behavior implied by pagination, more context is needed.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('limit' and 'next'). The description adds no additional meaning about parameters beyond implying pagination through 'next', which is already clear from the schema. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('Get') and resource ('shopify customers'), making the purpose understandable. It distinguishes from siblings like 'tag-customer' or 'get-order' by specifying customers as the target. However, it doesn't explicitly differentiate from other customer-related tools (none listed), so it's not a perfect 5.

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

Usage Guidelines2/5

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

The description mentions 'pagination support' which implies usage for large datasets, but provides no explicit guidance on when to use this tool versus alternatives like 'get-order' or 'get-products'. No prerequisites, exclusions, or comparisons to sibling tools are stated.

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

Install Server

Other Tools

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/amir-bengherbi/shopify-mcp-server'

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