Skip to main content
Glama

list_customers

Retrieve customers with optional filtering by status, search term, and pagination. Optionally include related data such as subscriptions, invoices, or payment methods.

Instructions

List customers with optional query parameters for filtering and pagination. GET /customers. See https://apiguide.rebillia.com/ for the Public API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoNoPage number (default: 1)
itemPerPageNoItems per page (default: 25, max 250)
queryNoSearch term: matches firstName, lastName, email, and related company name/support pin
statusNoFilter by customer status: active, disabled, or archived
sortByNoSort direction: ASC or DESC (default: ASC for customers)
orderByNoColumn to sort by (e.g. firstName, lastName, email, createdAt). Default: firstName
includeNoComma-separated includes: addressbook, paymentmethod, lastInvoice, subscriptions, unpaidInvoices, externalCustomers
filterIdNoOptional saved filter ID to apply predefined filters

Implementation Reference

  • Handler function for list_customers tool. Extracts arguments (pageNo, itemPerPage, query, status, sortBy, orderBy, include, filterId) from args, maps them to ListCustomersParams, then delegates to the customer service's listCustomers function via handleToolCall.
    async function handler(client: Client, args: Record<string, unknown> | undefined) {
      const a = (args ?? {}) as Record<string, unknown>;
      const params: customerService.ListCustomersParams = {
        pageNo: a.pageNo != null ? Number(a.pageNo) : undefined,
        itemPerPage: a.itemPerPage != null ? Number(a.itemPerPage) : undefined,
        query: typeof a.query === "string" ? a.query : undefined,
        status: typeof a.status === "string" ? a.status : undefined,
        sortBy: typeof a.sortBy === "string" ? a.sortBy : undefined,
        orderBy: typeof a.orderBy === "string" ? a.orderBy : undefined,
        include: typeof a.include === "string" ? a.include : undefined,
        filterId: a.filterId != null ? Number(a.filterId) : undefined,
      };
      return handleToolCall(() => customerService.listCustomers(client, params));
    }
    
    export const listCustomersTool: Tool = {
      definition,
      handler,
    };
  • MCP tool definition and input schema for list_customers. Defines the tool name, description, and inputSchema with optional parameters: pageNo, itemPerPage, query, status, sortBy, orderBy, include, filterId.
    const definition = {
      name: "list_customers",
      description:
        "List customers with optional query parameters for filtering and pagination. GET /customers. See https://apiguide.rebillia.com/ for the Public API.",
      inputSchema: {
        type: "object" as const,
        properties: {
          pageNo: { type: "number", description: "Page number (default: 1)" },
          itemPerPage: { type: "number", description: "Items per page (default: 25, max 250)" },
          query: {
            type: "string",
            description: "Search term: matches firstName, lastName, email, and related company name/support pin",
          },
          status: {
            type: "string",
            description: "Filter by customer status: active, disabled, or archived",
          },
          sortBy: { type: "string", description: "Sort direction: ASC or DESC (default: ASC for customers)" },
          orderBy: {
            type: "string",
            description: "Column to sort by (e.g. firstName, lastName, email, createdAt). Default: firstName",
          },
          include: {
            type: "string",
            description:
              "Comma-separated includes: addressbook, paymentmethod, lastInvoice, subscriptions, unpaidInvoices, externalCustomers",
          },
          filterId: { type: "number", description: "Optional saved filter ID to apply predefined filters" },
        },
      },
    };
  • TypeScript interface for ListCustomersParams defining the typed parameters used by the service layer.
    export interface ListCustomersParams {
      pageNo?: number;
      itemPerPage?: number;
      query?: string;
      status?: string;
      sortBy?: string;
      orderBy?: string;
      include?: string;
      filterId?: number;
    }
  • Registration of list_customers tool: listCustomersTool is included in the registerCustomerTools() array that aggregates all customer tools for the main registry.
    export function registerCustomerTools(): Tool[] {
      return [
        listCustomersTool,
        getCustomerTool,
        createCustomerTool,
        updateCustomerTool,
        deleteCustomerTool,
        getCustomerInvoicesTool,
        getCustomerUnpaidInvoicesTool,
        getCustomerSubscriptionsTool,
        getCustomerLogsTool,
        listCustomerAddressesTool,
        getCustomerAddressTool,
        createCustomerAddressTool,
        updateCustomerAddressTool,
        deleteCustomerAddressTool,
        listCustomerPaymentMethodsTool,
        getCustomerPaymentMethodTool,
        createCustomerPaymentMethodTool,
        updateCustomerPaymentMethodTool,
        deleteCustomerPaymentMethodTool,
        listCustomerChargesCreditsTool,
        createCustomerChargeCreditTool,
        deleteCustomerChargeCreditTool,
      ];
    }
  • Service-level function that builds query parameters and makes the GET /customers API call via the HTTP client, returning a PaginatedResponse of Customer objects.
    export async function listCustomers(
      client: Client,
      params: ListCustomersParams
    ): Promise<PaginatedResponse<Customer>> {
      const search = new URLSearchParams();
      if (params.pageNo != null) search.append("pageNo", String(params.pageNo));
      if (params.itemPerPage != null) search.append("itemPerPage", String(params.itemPerPage));
      if (params.query) search.append("query", params.query);
      if (params.status) search.append("status", params.status);
      if (params.sortBy) search.append("sortBy", params.sortBy);
      if (params.orderBy) search.append("orderBy", params.orderBy);
      if (params.include) search.append("include", params.include);
      if (params.filterId != null) search.append("filterId", String(params.filterId));
      return client.get<PaginatedResponse<Customer>>(`/customers${queryString(search)}`);
    }
Behavior3/5

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

No annotations provided, so the description must cover behavior. It states it lists customers with optional filters, which is accurate for a read operation. However, it does not disclose pagination limits (e.g., max 250 items per page) or default values, nor does it mention rate limits or authentication requirements. The behavioral traits are basic and adequate but not comprehensive.

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?

Two sentences, each serving a distinct purpose: stating the core function and referencing the API documentation. No redundant or extraneous text. Front-loaded with the primary action.

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

Completeness4/5

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

Given the complexity (8 optional parameters, no output schema), the description covers the main purpose but omits details about response structure or pagination behavior (e.g., how to handle multiple pages). The link to the API guide partially compensates, but for an agent, explicit hints about iteration would improve usability.

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?

All 8 parameters are fully described in the input schema (100% coverage). The tool description adds no additional meaning beyond repeating that they are for filtering and pagination. Per guidelines, baseline is 3 when schema coverage is high, and the description does not enhance parameter semantics.

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 clearly states the action ('list customers') and the resource ('customers'), with optional filtering and pagination. It distinguishes from sibling tools like 'get_customer' by indicating a list operation. The inclusion of the HTTP method and API guide link adds clarity.

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

Usage Guidelines4/5

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

The description implies usage for retrieving multiple customers with filtering, but does not explicitly state when not to use it or name alternatives. Given siblings like get, create, update, delete, the usage context is clear but lacks explicit guidance on when to prefer this over other tools.

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/rhinosaas/rebillia-mcp-server'

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