delete_invoice_payment_by_id_and_invoice_id
Delete a payment associated with an invoice. Provide the invoice ID and payment ID to remove the payment record.
Instructions
Delete a payment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice_id | Yes | ID of the parent resource | |
| id | Yes | ID of the payment to delete |
Implementation Reference
- src/tools/payments.ts:54-73 (handler)The tool handler registered via server.registerTool. It calls apiDelete on /invoices/{invoice_id}/payments/{id}, logs the response, and returns a formatted deletion result.
server.registerTool( "delete_invoice_payment_by_id_and_invoice_id", { description: "Delete a payment.", annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true }, inputSchema: { invoice_id: z.number().int().positive().describe("ID of the parent resource"), id: z.number().int().positive().describe("ID of the payment to delete"), }, }, async ({ invoice_id, id }) => { try { const record = await apiDelete<EduframeRecord>(`/invoices/${invoice_id}/payments/${id}`); void logResponse("delete_invoice_payment_by_id_and_invoice_id", { invoice_id, id }, record); return formatDelete(record, "payment"); } catch (error) { return formatError(error); } }, ); - src/tools/payments.ts:59-62 (schema)Zod input schema for the tool: invoice_id (number) and id (number) as required positive integers.
inputSchema: { invoice_id: z.number().int().positive().describe("ID of the parent resource"), id: z.number().int().positive().describe("ID of the payment to delete"), }, - src/tools/payments.ts:9-9 (registration)Registration function that calls server.registerTool for all payment tools including delete_invoice_payment_by_id_and_invoice_id.
export function registerPaymentTools(server: McpServer): void { - src/tools/index.ts:39-39 (registration)Import of registerPaymentTools into the central tools index registration aggregator.
import { registerPaymentTools } from "./payments"; - src/api.ts:219-229 (helper)The apiDelete helper function that performs the HTTP DELETE request used by the tool handler.
export async function apiDelete<T>(path: string): Promise<T> { const { token } = getConfig(); const url = buildUrl(path); const response = await fetch(url.toString(), { method: "DELETE", headers: buildHeaders(token), }); return handleResponse<T>(response); }