Skip to main content
Glama

list_customer_payment_methods

Retrieve all payment methods for a customer. Use pagination to manage large result sets.

Instructions

List all payment methods for a customer. GET /customers/{customerId}/paymentmethods. Optional: pageNo, itemPerPage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesCustomer ID (required)
pageNoNoPage number (default: 1)
itemPerPageNoItems per page (default: API default)

Implementation Reference

  • The handler function for the list_customer_payment_methods tool. It parses args with Zod (customerId required, pageNo/itemPerPage optional), then calls customerService.listCustomerPaymentMethods().
    async function handler(client: Client, args: Record<string, unknown> | undefined) {
      const parsed = schema.safeParse(args);
      if (!parsed.success) {
        return errorResult(parsed.error.errors.map((e) => e.message).join("; "));
      }
      const { customerId, pageNo, itemPerPage } = parsed.data;
      return handleToolCall(() =>
        customerService.listCustomerPaymentMethods(client, customerId, { pageNo, itemPerPage })
      );
    }
  • Zod schema for input validation: customerId (required string), pageNo (optional positive int), itemPerPage (optional positive int).
    const schema = z.object({
      customerId: z.string().min(1, "customerId is required"),
      pageNo: z.number().int().min(1).optional(),
      itemPerPage: z.number().int().min(1).optional(),
    });
  • MCP tool definition/inputSchema with name 'list_customer_payment_methods', description, and JSON Schema properties for customerId, pageNo, itemPerPage.
    const definition = {
      name: "list_customer_payment_methods",
      description:
        "List all payment methods for a customer. GET /customers/{customerId}/paymentmethods. Optional: pageNo, itemPerPage.",
      inputSchema: {
        type: "object" as const,
        properties: {
          customerId: { type: "string", description: "Customer ID (required)" },
          pageNo: { type: "number", description: "Page number (default: 1)" },
          itemPerPage: { type: "number", description: "Items per page (default: API default)" },
        },
        required: ["customerId"],
      },
    };
  • Registration of the tool in the registerCustomerTools() function, which returns all customer tools including listCustomerPaymentMethodsTool.
    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,
      ];
    }
  • The underlying service function that makes the GET /customers/{customerId}/paymentmethods API call with optional pageNo and itemPerPage query params.
    export async function listCustomerPaymentMethods(
      client: Client,
      customerId: string,
      params?: Pick<PaginationIncludeParams, "pageNo" | "itemPerPage">
    ): Promise<CustomerPaymentMethod[] | PaginatedResponse<CustomerPaymentMethod>> {
      const search = new URLSearchParams();
      if (params?.pageNo != null) search.append("pageNo", String(params.pageNo));
      if (params?.itemPerPage != null) search.append("itemPerPage", String(params.itemPerPage));
      const q = search.toString();
      return client.get<CustomerPaymentMethod[] | PaginatedResponse<CustomerPaymentMethod>>(
        `/customers/${customerId}/paymentmethods${q ? `?${q}` : ""}`
      );
    }
Behavior3/5

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

No annotations are provided, so the description carries the burden. It describes a listing operation without side effects, but does not explicitly state it is read-only or safe. No contradictions with annotations.

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 concise sentences with no wasted words. The purpose and endpoint are front-loaded, followed by optional parameters.

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

Completeness3/5

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

For a simple list tool without output schema, the description covers the basic purpose and pagination params. However, it lacks details on return structure (e.g., array of payment methods) which could help the agent.

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 coverage is 100%, so baseline is 3. The description mentions optional 'pageNo' and 'itemPerPage' but adds no meaning beyond the schema descriptions.

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 all payment methods for a customer') and includes the HTTP endpoint, which distinguishes it from sibling tools like 'get_customer_payment_method' (singular) and 'create_customer_payment_method'.

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?

The description implies usage for listing all payment methods but does not explicitly contrast with sibling tools like 'get_customer_payment_method' or mention when not to use it. No when/to use guidance is provided.

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