Skip to main content
Glama

delete_customer_charge_credit

Delete a charge or credit from a customer account. Requires customer ID and charge/credit ID; fails if linked to an invoice.

Instructions

Delete a charge or credit for a customer. DELETE /customers/{customerId}/charges_credits/{chargeCreditId}. Fails if the charge/credit has invoice details assigned.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesCustomer ID (required)
chargeCreditIdYesCharge/credit ID (required)

Implementation Reference

  • The handler function for delete_customer_charge_credit tool. Parses input args (customerId, chargeCreditId) via Zod, then delegates to customerService.deleteCustomerChargeCredit().
    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, chargeCreditId } = parsed.data;
      return handleToolCall(() =>
        customerService.deleteCustomerChargeCredit(client, customerId, chargeCreditId)
      );
    }
  • Zod schema validating customerId (string, min 1) and chargeCreditId (string, min 1).
    const schema = z.object({
      customerId: z.string().min(1, "customerId is required"),
      chargeCreditId: z.string().min(1, "chargeCreditId is required"),
    });
  • Tool definition/registration with name 'delete_customer_charge_credit', description, and JSON input schema (customerId + chargeCreditId both required).
    const definition = {
      name: "delete_customer_charge_credit",
      description:
        "Delete a charge or credit for a customer. DELETE /customers/{customerId}/charges_credits/{chargeCreditId}. Fails if the charge/credit has invoice details assigned.",
      inputSchema: {
        type: "object" as const,
        properties: {
          customerId: { type: "string", description: "Customer ID (required)" },
          chargeCreditId: { type: "string", description: "Charge/credit ID (required)" },
        },
        required: ["customerId", "chargeCreditId"],
      },
    };
  • Tool registered in the customer tools collection via registerCustomerTools() returning the deleteCustomerChargeCreditTool.
    deleteCustomerChargeCreditTool,
  • Service helper that makes the DELETE API call to /customers/{customerId}/charges_credits/{chargeCreditId} via the HTTP client.
    export async function deleteCustomerChargeCredit(
      client: Client,
      customerId: string,
      chargeCreditId: string
    ): Promise<Record<string, unknown>> {
      const result = await client.delete<Record<string, unknown>>(
        `/customers/${customerId}/charges_credits/${chargeCreditId}`
      );
      return Object.keys(result ?? {}).length ? result : { success: true, message: "Charge/credit deleted" };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the failure condition (invoiced charges/credits), which is useful. However, it does not mention whether the deletion is irreversible, requires specific permissions, or has side effects on related data.

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 concise with two sentences. The first sentence clearly states the action and resource, and the second provides a critical constraint. No wasted words.

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 simplicity of the tool (two required parameters, no output schema, no nested objects), the description is largely complete. It provides the operation, endpoint, and a key precondition. It could mention irreversibility, but that is less critical for a delete operation.

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 input schema already provides full descriptions for both parameters (customerId and chargeCreditId) with 100% coverage. The description does not add additional meaning beyond what the schema offers, so it meets the baseline but does not enhance.

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 tool deletes a charge or credit for a customer and provides the HTTP endpoint. It effectively distinguishes itself from sibling tools like create_customer_charge_credit or list_customer_charges_credits by specifying the delete action and resource.

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 includes an important condition: 'Fails if the charge/credit has invoice details assigned.' This informs the agent when not to use the tool. However, it does not explicitly state 'do not use if invoiced' or suggest alternatives, which would elevate it to a 5.

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