@teamnetwork-nz/xero-mcp-server 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,8 +7,8 @@ import { getClientHeaders } from "../helpers/get-client-headers.js";
|
|
|
7
7
|
async function fetchProfitAndLoss(fromDate, toDate, periods, timeframe, standardLayout, paymentsOnly) {
|
|
8
8
|
await xeroClient.authenticate();
|
|
9
9
|
const response = await xeroClient.accountingApi.getReportProfitAndLoss(xeroClient.tenantId, fromDate, toDate, periods, timeframe, undefined, // trackingCategoryID
|
|
10
|
-
undefined, // trackingOptionID
|
|
11
10
|
undefined, // trackingCategoryID2
|
|
11
|
+
undefined, // trackingOptionID
|
|
12
12
|
undefined, // trackingOptionID2
|
|
13
13
|
standardLayout, paymentsOnly, getClientHeaders());
|
|
14
14
|
return response.body.reports?.[0] ?? null;
|
|
@@ -28,7 +28,7 @@ async function fetchProfitAndLoss(fromDate, toDate, periods, timeframe, standard
|
|
|
28
28
|
*/
|
|
29
29
|
export async function listXeroProfitAndLoss(fromDate, toDate, periods, timeframe, standardLayout, paymentsOnly) {
|
|
30
30
|
try {
|
|
31
|
-
const profitAndLoss = await fetchProfitAndLoss(fromDate, toDate, periods, timeframe, paymentsOnly);
|
|
31
|
+
const profitAndLoss = await fetchProfitAndLoss(fromDate, toDate, periods, timeframe, standardLayout, paymentsOnly);
|
|
32
32
|
if (!profitAndLoss) {
|
|
33
33
|
return {
|
|
34
34
|
result: null,
|
|
@@ -7,7 +7,9 @@ const ListCreditNotesTool = CreateXeroTool("list-credit-notes", "List credit not
|
|
|
7
7
|
"Common patterns: " +
|
|
8
8
|
"unallocated credits to apply → statuses=[AUTHORISED], hasRemainingCredit=true; " +
|
|
9
9
|
"customer credit notes → type=ACCREC, statuses=[AUTHORISED]; " +
|
|
10
|
-
"supplier credits → type=ACCPAY."
|
|
10
|
+
"supplier credits → type=ACCPAY. " +
|
|
11
|
+
"Results include RemainingCredit/AppliedAmount and, where Xero returns them, the invoices " +
|
|
12
|
+
"each credit note has been allocated against — no need to diff invoice Total vs AmountDue to find this.", {
|
|
11
13
|
page: z.number().describe("Page number for pagination (starts at 1)."),
|
|
12
14
|
type: z.enum(["ACCREC", "ACCPAY"]).optional().describe("ACCREC = sales/customer credit notes. ACCPAY = purchase/supplier credit notes."),
|
|
13
15
|
contactId: z.string().optional().describe("Filter by contact ID."),
|
|
@@ -53,6 +55,17 @@ const ListCreditNotesTool = CreateXeroTool("list-credit-notes", "List credit not
|
|
|
53
55
|
creditNote.subTotal ? `Sub Total: ${creditNote.subTotal}` : null,
|
|
54
56
|
creditNote.totalTax ? `Total Tax: ${creditNote.totalTax}` : null,
|
|
55
57
|
`Total: ${creditNote.total || 0}`,
|
|
58
|
+
creditNote.remainingCredit !== undefined
|
|
59
|
+
? `Remaining Credit: ${creditNote.remainingCredit}`
|
|
60
|
+
: null,
|
|
61
|
+
creditNote.appliedAmount !== undefined
|
|
62
|
+
? `Applied Amount: ${creditNote.appliedAmount}`
|
|
63
|
+
: null,
|
|
64
|
+
creditNote.allocations?.length
|
|
65
|
+
? `Allocations:\n${creditNote.allocations
|
|
66
|
+
.map((allocation) => ` - ${allocation.amount} on ${allocation.date} → Invoice ${allocation.invoice?.invoiceNumber ?? allocation.invoice?.invoiceID ?? "Unknown"}`)
|
|
67
|
+
.join("\n")}`
|
|
68
|
+
: null,
|
|
56
69
|
creditNote.currencyCode
|
|
57
70
|
? `Currency: ${creditNote.currencyCode}`
|
|
58
71
|
: null,
|
|
@@ -5,8 +5,9 @@ import { formatUtcDatetime } from "../../helpers/datetime.js";
|
|
|
5
5
|
const ListProfitAndLossTool = CreateXeroTool("list-profit-and-loss", "Lists profit and loss report in Xero. This provides a summary of revenue, expenses, and profit or loss over a specified period of time.", {
|
|
6
6
|
fromDate: z.string().optional().describe("Optional start date in YYYY-MM-DD format"),
|
|
7
7
|
toDate: z.string().optional().describe("Optional end date in YYYY-MM-DD format"),
|
|
8
|
-
periods: z.number().optional().describe("Optional number of periods
|
|
9
|
-
timeframe: z.enum(["MONTH", "QUARTER", "YEAR"]).optional().describe("Optional
|
|
8
|
+
periods: z.number().int().min(1).max(11).optional().describe("Optional number of prior comparison periods (1-11). Xero returns the requested base period plus this many comparisons, so periods=3 returns 4 columns."),
|
|
9
|
+
timeframe: z.enum(["MONTH", "QUARTER", "YEAR"]).optional().describe("Optional spacing between comparison periods (MONTH, QUARTER, YEAR). It does not split a multi-month fromDate/toDate range into individual columns — " +
|
|
10
|
+
"Xero repeats the whole fromDate/toDate span for each comparison. Example: for 4 separate monthly columns, set fromDate/toDate to a single month and periods=3, NOT a 4-month range with periods=3 (which instead returns 4 rolling 4-month totals)."),
|
|
10
11
|
standardLayout: z.boolean().optional().describe("Optional flag to use standard layout"),
|
|
11
12
|
paymentsOnly: z.boolean().optional().describe("Optional flag to include only accounts with payments"),
|
|
12
13
|
}, async (args) => {
|