Skip to main content
Glama

delete_customer_payment_method

Remove a customer's saved payment method using their customer ID and payment method ID. Helps manage billing information by deleting outdated or invalid payment methods.

Instructions

Delete a payment method. DELETE /customers/{customerId}/paymentmethods/{paymentMethodId}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesCustomer ID (required)
paymentMethodIdYesPayment method ID (required)

Implementation Reference

  • The handler function that parses the Zod-validated customerId and paymentMethodId arguments and delegates to customerService.deleteCustomerPaymentMethod.
    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, paymentMethodId } = parsed.data;
      return handleToolCall(() =>
        customerService.deleteCustomerPaymentMethod(client, customerId, paymentMethodId)
      );
    }
  • Zod schema for input validation: requires customerId (string) and paymentMethodId (string), both min length 1.
    const schema = z.object({
      customerId: z.string().min(1, "customerId is required"),
      paymentMethodId: z.string().min(1, "paymentMethodId is required"),
    });
  • MCP ToolDefinition with name 'delete_customer_payment_method', description, and JSON Schema inputSchema listing customerId and paymentMethodId as required string properties.
    const definition = {
      name: "delete_customer_payment_method",
      description:
        "Delete a payment method. DELETE /customers/{customerId}/paymentmethods/{paymentMethodId}.",
      inputSchema: {
        type: "object" as const,
        properties: {
          customerId: { type: "string", description: "Customer ID (required)" },
          paymentMethodId: { type: "string", description: "Payment method ID (required)" },
        },
        required: ["customerId", "paymentMethodId"],
      },
    };
  • Exported Tool object combining the definition and handler. Imported and registered in tools/customers/index.ts via deleteCustomerPaymentMethodTool.
    export const deleteCustomerPaymentMethodTool: Tool = {
      definition,
      handler,
    };
  • The service-layer function that performs the DELETE HTTP call to /customers/{customerId}/paymentmethods/{paymentMethodId} and returns the result, falling back to a success message if empty.
    export async function deleteCustomerPaymentMethod(
      client: Client,
      customerId: string,
      paymentMethodId: string
    ): Promise<Record<string, unknown>> {
      const result = await client.delete<Record<string, unknown>>(
        `/customers/${customerId}/paymentmethods/${paymentMethodId}`
      );
      return Object.keys(result ?? {}).length ? result : { success: true, message: "Payment method deleted" };
    }
Behavior2/5

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

The description indicates a destructive action but provides no further behavioral details (e.g., whether deletion is irreversible, cascading effects on subscriptions, or required permissions). With no annotations, the description should compensate, but it does not.

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 extremely concise: one sentence stating the action and the HTTP endpoint. Every word is necessary, and the core purpose is front-loaded.

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 delete operation with two required parameters and no expected output schema, the description is adequate but lacks details like return value, error handling, or constraints (e.g., cannot delete a default payment method). Could be slightly more informative.

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% with descriptions for both parameters. The tool description adds no additional meaning beyond the schema, such as the relationship between parameters or how to obtain the IDs. Baseline 3 is appropriate.

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 (delete) and the resource (a payment method), with the HTTP method and URL template. This distinguishes it from sibling tools like create, update, get, and list payment methods.

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?

No guidance on when to use this tool versus alternatives (e.g., updating a payment method instead of deleting it). It does not mention prerequisites, constraints, or when deletion might be inappropriate.

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