get_invoice
Retrieve a specific invoice from Visa Acceptance by providing the invoice ID to access detailed billing information.
Instructions
This tool will get a specific invoice from Visa Acceptance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Invoice ID (required) |
Implementation Reference
- The core handler function that executes the 'get_invoice' tool logic: fetches the invoice by ID using Cybersource InvoicesApi, handles errors, masks sensitive customer information, and returns the result.export const getInvoice = async ( visaClient: any, context: VisaContext, params: z.infer<ReturnType<typeof getInvoiceParameters>> ) => { try { const invoiceApiInstance = new cybersourceRestApi.InvoicesApi(visaClient.configuration, visaClient.visaApiClient); const result = await new Promise((resolve, reject) => { invoiceApiInstance.getInvoice(params.id, (error: any, data: any) => { if (error) { reject(error); } else { resolve(data); } }); }); const maskedResult = maskInvoiceCustomerInfo(result); return maskedResult; } catch (error) { return 'Failed to get invoice'; } };
- Zod schema defining the input parameters for the 'get_invoice' tool: requires an 'id' string (Invoice ID).export const getInvoiceParameters = ( context: VisaContext = {} as VisaContext ) => { return z.object({ id: z.string().describe('Invoice ID (required)') }); };
- typescript/src/shared/invoices/getInvoice.ts:54-67 (registration)Defines and exports the tool registration object for 'get_invoice', including method name, description, parameters schema, actions permissions, and the execute handler reference. Imported and included in the master tools list.const tool = (context: VisaContext): Tool => ({ method: 'get_invoice', name: 'Get Invoice', description: getInvoicePrompt(context), parameters: getInvoiceParameters(context), actions: { invoices: { read: true, }, }, execute: getInvoice, }); export default tool;
- typescript/src/shared/tools.ts:40-52 (registration)Aggregates all tool modules including 'get_invoice' (via getInvoiceToolModule) into a list returned by createTools, used by MCP server toolkits for registration.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) ];