Skip to main content
Glama
visaacceptance

Visa Acceptance

send_invoice

Sends an invoice to a customer via Visa Acceptance. Requires only the invoice ID for processing.

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 main handler function that executes the 'send_invoice' tool logic. It uses the CyberSource InvoicesApi.performSendAction() to send an invoice by ID, then masks customer info in the result.
    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 parameter for the tool: invoice_id (string, required).
    export const sendInvoiceParameters = (
      context: VisaContext = {} as VisaContext
    ) => {
      return z.object({
        invoice_id: z.string().describe('Invoice ID (required)')
      });
    };
  • The tool definition object registering 'send_invoice' as the method name, with name, description, parameters, actions, and execute handler.
    const tool = (context: VisaContext): Tool => ({
      method: 'send_invoice',
      name: 'Send Invoice',
      description: sendInvoicePrompt(context),
      parameters: sendInvoiceParameters(context),
      actions: {
        invoices: {
          update: true,
        },
      },
      execute: sendInvoice,
    });
  • The createTools function that aggregates all tools including sendInvoiceToolModule into a Tool array.
    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 maskInvoiceCustomerInfo used by the sendInvoice handler to mask customer PII before returning the result.
    export const maskInvoiceCustomerInfo = (
      invoice: any,
      context?: Context
    ): any => {
      try {
        if (!invoice) return invoice;
        
        const maskedInvoice = JSON.parse(JSON.stringify(invoice));
        
        if (maskedInvoice.customerInformation) {
          if (maskedInvoice.customerInformation.name) {
            maskedInvoice.customerInformation.name = maskPII(maskedInvoice.customerInformation.name, 'end');
          }
          
          if (maskedInvoice.customerInformation.email) {
            const emailParts = maskedInvoice.customerInformation.email.split('@');
            if (emailParts.length === 2) {
              const maskedLocalPart = maskPII(emailParts[0], 'end');
              maskedInvoice.customerInformation.email = `${maskedLocalPart}@${emailParts[1]}`;
            } else {
              maskedInvoice.customerInformation.email = maskPII(maskedInvoice.customerInformation.email, 'end');
            }
          }
        }
        
        return maskedInvoice;
      } catch (error) {
        return 'Failed to mask invoice customer information';
      }
    };
Behavior2/5

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

No annotations exist; description only says 'will send', implying mutation but no detail on idempotency, state requirements, failure modes, or side effects. The agent lacks crucial behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no wasted words. However, it is overly concise and omits important details; conciseness is not a substitute for completeness.

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?

Tool is simple (1 param, no output schema). Description covers the basic action but misses outcomes, error conditions, and whether sending requires a pre-existing invoice. Barely adequate.

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% (1 param described). Description does not add meaning beyond the schema; it clarifies nothing about invoice_id format or retrieval. Adequate but no added value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (send) and resource (invoice) with context (Visa Acceptance). It distinguishes from sibling tools like create_invoice or cancel_invoice, but does not specify the delivery mechanism (e.g., email).

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 vs alternatives (e.g., must invoice be created first? Not mentioned). No prerequisites, exclusions, or conditional logic provided.

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

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