Skip to main content
Glama

cancel_invoice

Cancel an invoice in Visa Acceptance by providing the invoice ID to void transactions and update payment records.

Instructions

This tool will cancel an invoice in Visa Acceptance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoice_idYesInvoice ID (required)

Implementation Reference

  • The handler function that performs the invoice cancellation using the Cybersource InvoicesApi.performCancelAction.
    export const cancelInvoice = async ( visaClient: any, context: VisaContext, params: z.infer<ReturnType<typeof cancelInvoiceParameters>> ) => { try { const invoiceApiInstance = new cybersourceRestApi.InvoicesApi(visaClient.configuration, visaClient.visaApiClient); const result = await new Promise((resolve, reject) => { invoiceApiInstance.performCancelAction(params.invoice_id, (error: any, data: any, response: any) => { if (error) { reject(error); } else { resolve({ data, status: response['status'] }); } }); }); const maskedResult = maskInvoiceCustomerInfo(result); return maskedResult; } catch (error) { return 'Failed to cancel invoice'; } };
  • Zod schema defining the input parameters for the cancel_invoice tool, requiring invoice_id.
    export const cancelInvoiceParameters = ( context: VisaContext = {} as VisaContext ) => { return z.object({ invoice_id: z.string().describe('Invoice ID (required)') }); };
  • Tool module definition and export, specifying method 'cancel_invoice', parameters, description, actions, and execute handler.
    const tool = (context: VisaContext): Tool => ({ method: 'cancel_invoice', name: 'Cancel Invoice', description: cancelInvoicePrompt(context), parameters: cancelInvoiceParameters(context), actions: { invoices: { update: true, }, }, execute: cancelInvoice, });
  • Inclusion of the cancelInvoice tool module in the createTools function, which aggregates all tools.
    cancelInvoiceToolModule(context),
  • Import of the cancelInvoice tool module.
    import cancelInvoiceToolModule from './invoices/cancelInvoice';

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/visaacceptance/agent-toolkit'

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