Skip to main content
Glama
visaacceptance

Visa Acceptance

send_invoice

Send invoices to customers through the Visa Acceptance platform. This tool processes invoice delivery using a required invoice ID for transaction completion.

Instructions

This tool will send an invoice to the customer from Visa Acceptance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoice_idYesInvoice ID (required)

Implementation Reference

  • The handler function that implements the core logic of the 'send_invoice' tool, sending the invoice via Cybersource REST API and masking customer info.
    export const sendInvoice = async (
      visaClient: any,
      context: VisaContext,
      params: z.infer<ReturnType<typeof sendInvoiceParameters>>
    ) => {
      try {
        const invoiceApiInstance = new cybersourceRestApi.InvoicesApi(visaClient.configuration, visaClient.visaApiClient);
        
        const result = await new Promise((resolve, reject) => {
          invoiceApiInstance.performSendAction(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 send invoice';
      }
    };
  • Zod schema defining the input parameters for the send_invoice tool.
    export const sendInvoiceParameters = (
      context: VisaContext = {} as VisaContext
    ) => {
      return z.object({
        invoice_id: z.string().describe('Invoice ID (required)')
      });
    };
  • Definition of the tool object/module for 'send_invoice', which is exported as default and includes method name, description, parameters, and execute handler reference.
    const tool = (context: VisaContext): Tool => ({
      method: 'send_invoice',
      name: 'Send Invoice',
      description: sendInvoicePrompt(context),
      parameters: sendInvoiceParameters(context),
      actions: {
        invoices: {
          update: true,
        },
      },
      execute: sendInvoice,
    });
  • Registration of the send_invoice tool within the createTools function, which aggregates and returns all available tools including sendInvoiceToolModule(context).
    export function createTools(context: VisaContext): Tool[] {
      return [
        createInvoiceToolModule(context),
        updateInvoiceToolModule(context),
        getInvoiceToolModule(context),
        listInvoicesToolModule(context),
        sendInvoiceToolModule(context),
        cancelInvoiceToolModule(context),
        createPaymentLinkToolModule(context),
        updatePaymentLinkToolModule(context),
        getPaymentLinkToolModule(context),
        listPaymentLinkToolModule(context)
      ];
    }
  • Helper function generating the description/prompt for the send_invoice tool.
    export const sendInvoicePrompt = (context: VisaContext = {} as VisaContext) => `
    This tool will send an invoice to the customer from Visa Acceptance.
    `;

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