Skip to main content
Glama

Xero MCP Server

Official
MIT License
293
128
  • Apple
  • Linux
update-bank-transaction.tool.ts2.53 kB
import { z } from "zod"; import { CreateXeroTool } from "../../helpers/create-xero-tool.js"; import { updateXeroBankTransaction } from "../../handlers/update-xero-bank-transaction.handler.js"; import { bankTransactionDeepLink } from "../../consts/deeplinks.js"; const lineItemSchema = z.object({ description: z.string(), quantity: z.number(), unitAmount: z.number(), accountCode: z.string(), taxType: z.string(), }); const UpdateBankTransactionTool = CreateXeroTool( "update-bank-transaction", `Update a bank transaction in Xero. When a bank transaction is updated, a deep link to the bank transaction in Xero is returned. This deep link can be used to view the bank transaction in Xero directly. This link should be displayed to the user.`, { bankTransactionId: z.string(), type: z.enum(["RECEIVE", "SPEND"]).optional(), contactId: z.string().optional(), lineItems: z.array(lineItemSchema).optional().describe( "All line items must be provided. Any line items not provided will be removed. Including existing line items. \ Do not modify line items that have not been specified by the user", ), reference: z.string().optional(), date: z.string().optional() }, async ( { bankTransactionId, type, contactId, lineItems, reference, date } ) => { const result = await updateXeroBankTransaction(bankTransactionId, type, contactId, lineItems, reference, date); if (result.isError) { return { content: [ { type: "text" as const, text: `Error updating bank transaction: ${result.error}`, }, ], }; } const bankTransaction = result.result; const deepLink = bankTransaction.bankAccount.accountID && bankTransaction.bankTransactionID ? bankTransactionDeepLink(bankTransaction.bankAccount.accountID, bankTransaction.bankTransactionID) : null; return { content: [ { type: "text" as const, text: [ "Bank transaction updated successfully:", `ID: ${bankTransaction?.bankTransactionID}`, `Date: ${bankTransaction?.date}`, `Contact: ${bankTransaction?.contact?.name}`, `Total: ${bankTransaction?.total}`, `Status: ${bankTransaction?.status}`, deepLink ? `Link to view: ${deepLink}` : null ].filter(Boolean).join("\n"), }, ], }; } ); export default UpdateBankTransactionTool;

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/XeroAPI/xero-mcp-server'

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