@armor/zuora-mcp 1.2.0 → 1.3.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.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/resources.js +1 -1
- package/dist/tools.d.ts +21 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +134 -27
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/zuora-client.d.ts +10 -2
- package/dist/zuora-client.d.ts.map +1 -1
- package/dist/zuora-client.js +27 -6
- package/dist/zuora-client.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ async function main() {
|
|
|
71
71
|
console.error("\nRequired environment variables:");
|
|
72
72
|
console.error(" ZUORA_CLIENT_ID - OAuth2 client ID from Zuora Admin");
|
|
73
73
|
console.error(" ZUORA_CLIENT_SECRET - OAuth2 client secret");
|
|
74
|
-
console.error(" ZUORA_BASE_URL - Zuora API base URL (e.g., https://rest.
|
|
74
|
+
console.error(" ZUORA_BASE_URL - Zuora API base URL (e.g., https://rest.apisandbox.zuora.com)");
|
|
75
75
|
console.error("\nOptional:");
|
|
76
76
|
console.error(" DEBUG=true - Enable debug logging");
|
|
77
77
|
process.exit(1);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE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AM,CAAC,KAAK,CAAC,CAAC;YACzD,OAAO,gBAAgB,CAAC;gBACtB,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,yBAAyB,OAAO,EAAE;aAC5C,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CACF,CAAC;IAEF,8BAA8B;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,+BAA+B,CAAC,CAAC;QAC9D,OAAO,CAAC,KAAK,CACX,IAAI,WAAW,kBAAkB,MAAM,CAAC,YAAY,EAAE,CACvD,CAAC;QACF,OAAO,CAAC,KAAK,CACX,IAAI,WAAW,uBAAuB,iBAAiB,CAAC,MAAM,EAAE,CACjE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,CAAC"}
|
package/dist/resources.js
CHANGED
|
@@ -96,7 +96,7 @@ SELECT field1, field2, ... FROM ObjectName [WHERE conditions] [ORDER BY field [A
|
|
|
96
96
|
| IN | \`WHERE Id IN ('id1', 'id2', 'id3')\` |
|
|
97
97
|
| AND | \`WHERE Status = 'Active' AND Balance > 0\` |
|
|
98
98
|
| OR | \`WHERE Status = 'Active' OR Status = 'Draft'\` |
|
|
99
|
-
| IS NULL | \`WHERE TermEndDate IS NULL\` (for EVERGREEN)
|
|
99
|
+
| IS NULL | \`WHERE TermEndDate IS NULL\` (for EVERGREEN) |
|
|
100
100
|
| IS NOT NULL | \`WHERE CancelledDate IS NOT NULL\` |
|
|
101
101
|
|
|
102
102
|
## Key Limitations
|
package/dist/tools.d.ts
CHANGED
|
@@ -49,10 +49,13 @@ export declare const schemas: {
|
|
|
49
49
|
}>;
|
|
50
50
|
listSubscriptions: z.ZodObject<{
|
|
51
51
|
accountKey: z.ZodString;
|
|
52
|
+
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
52
53
|
}, "strip", z.ZodTypeAny, {
|
|
53
54
|
accountKey: string;
|
|
55
|
+
maxResults?: number | undefined;
|
|
54
56
|
}, {
|
|
55
57
|
accountKey: string;
|
|
58
|
+
maxResults?: number | undefined;
|
|
56
59
|
}>;
|
|
57
60
|
getPayment: z.ZodObject<{
|
|
58
61
|
paymentId: z.ZodString;
|
|
@@ -76,17 +79,23 @@ export declare const schemas: {
|
|
|
76
79
|
}>;
|
|
77
80
|
executeZoqlQuery: z.ZodObject<{
|
|
78
81
|
zoqlQuery: z.ZodEffects<z.ZodString, string, string>;
|
|
82
|
+
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
79
83
|
}, "strip", z.ZodTypeAny, {
|
|
80
84
|
zoqlQuery: string;
|
|
85
|
+
maxResults?: number | undefined;
|
|
81
86
|
}, {
|
|
82
87
|
zoqlQuery: string;
|
|
88
|
+
maxResults?: number | undefined;
|
|
83
89
|
}>;
|
|
84
90
|
continueZoqlQuery: z.ZodObject<{
|
|
85
91
|
queryLocator: z.ZodString;
|
|
92
|
+
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
86
93
|
}, "strip", z.ZodTypeAny, {
|
|
87
94
|
queryLocator: string;
|
|
95
|
+
maxResults?: number | undefined;
|
|
88
96
|
}, {
|
|
89
97
|
queryLocator: string;
|
|
98
|
+
maxResults?: number | undefined;
|
|
90
99
|
}>;
|
|
91
100
|
listProducts: z.ZodObject<{
|
|
92
101
|
page: z.ZodDefault<z.ZodNumber>;
|
|
@@ -129,13 +138,16 @@ export declare const schemas: {
|
|
|
129
138
|
field: z.ZodEnum<["Name", "AccountNumber", "Status", "Currency", "Balance"]>;
|
|
130
139
|
value: z.ZodEffects<z.ZodString, string, string>;
|
|
131
140
|
operator: z.ZodDefault<z.ZodEnum<["=", "!=", "LIKE", ">", "<", ">=", "<="]>>;
|
|
141
|
+
maxResults: z.ZodOptional<z.ZodNumber>;
|
|
132
142
|
}, "strip", z.ZodTypeAny, {
|
|
133
143
|
value: string;
|
|
134
144
|
field: "Name" | "AccountNumber" | "Status" | "Currency" | "Balance";
|
|
135
145
|
operator: "=" | "!=" | "LIKE" | ">" | "<" | ">=" | "<=";
|
|
146
|
+
maxResults?: number | undefined;
|
|
136
147
|
}, {
|
|
137
148
|
value: string;
|
|
138
149
|
field: "Name" | "AccountNumber" | "Status" | "Currency" | "Balance";
|
|
150
|
+
maxResults?: number | undefined;
|
|
139
151
|
operator?: "=" | "!=" | "LIKE" | ">" | "<" | ">=" | "<=" | undefined;
|
|
140
152
|
}>;
|
|
141
153
|
listUsage: z.ZodObject<{
|
|
@@ -976,10 +988,19 @@ export declare const schemas: {
|
|
|
976
988
|
}>;
|
|
977
989
|
getAccountBillingOverview: z.ZodObject<{
|
|
978
990
|
accountKey: z.ZodString;
|
|
991
|
+
maxInvoices: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
992
|
+
maxPayments: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
993
|
+
maxSubscriptions: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
979
994
|
}, "strip", z.ZodTypeAny, {
|
|
980
995
|
accountKey: string;
|
|
996
|
+
maxInvoices: number;
|
|
997
|
+
maxPayments: number;
|
|
998
|
+
maxSubscriptions: number;
|
|
981
999
|
}, {
|
|
982
1000
|
accountKey: string;
|
|
1001
|
+
maxInvoices?: number | undefined;
|
|
1002
|
+
maxPayments?: number | undefined;
|
|
1003
|
+
maxSubscriptions?: number | undefined;
|
|
983
1004
|
}>;
|
|
984
1005
|
getRevenueByProduct: z.ZodObject<{
|
|
985
1006
|
limit: z.ZodDefault<z.ZodNumber>;
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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AK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC;IACvB,MAAM,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,EA8f/C,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -79,6 +79,12 @@ export const schemas = {
|
|
|
79
79
|
.string()
|
|
80
80
|
.min(1)
|
|
81
81
|
.describe("Account ID or account number"),
|
|
82
|
+
maxResults: z
|
|
83
|
+
.number()
|
|
84
|
+
.int()
|
|
85
|
+
.min(1)
|
|
86
|
+
.optional()
|
|
87
|
+
.describe("Maximum number of subscriptions to return. When specified, results are truncated server-side. Omit to return all subscriptions for the account."),
|
|
82
88
|
}),
|
|
83
89
|
// Payment Tools
|
|
84
90
|
getPayment: z.object({
|
|
@@ -116,15 +122,27 @@ export const schemas = {
|
|
|
116
122
|
"Syntax: SELECT field1, field2 FROM ObjectName WHERE condition. " +
|
|
117
123
|
"Key objects: Account, Invoice, Payment, Subscription, RatePlan, " +
|
|
118
124
|
"RatePlanCharge, Product, ProductRatePlan, Contact. " +
|
|
119
|
-
"Limitations: No JOINs. Max 2000 records per call. " +
|
|
125
|
+
"Limitations: No JOINs supported. Max 2000 records per call. " +
|
|
120
126
|
"Use continue_zoql_query with queryLocator for pagination. " +
|
|
121
127
|
"Example: SELECT Id, AccountNumber, Balance FROM Account WHERE Status = 'Active'"),
|
|
128
|
+
maxResults: z
|
|
129
|
+
.number()
|
|
130
|
+
.int()
|
|
131
|
+
.min(1)
|
|
132
|
+
.optional()
|
|
133
|
+
.describe("Maximum records to return. When specified, results are truncated server-side to exactly this count. ZOQL has no LIMIT clause, so this parameter handles it at the application layer. Omit to return all records from the first page (up to 2000)."),
|
|
122
134
|
}),
|
|
123
135
|
continueZoqlQuery: z.object({
|
|
124
136
|
queryLocator: z
|
|
125
137
|
.string()
|
|
126
138
|
.min(1)
|
|
127
139
|
.describe("Query locator from a previous ZOQL query result for pagination"),
|
|
140
|
+
maxResults: z
|
|
141
|
+
.number()
|
|
142
|
+
.int()
|
|
143
|
+
.min(1)
|
|
144
|
+
.optional()
|
|
145
|
+
.describe("Maximum records to return from this continuation page. When specified, results are truncated server-side. Omit to return all records from the page (up to 2000)."),
|
|
128
146
|
}),
|
|
129
147
|
// Product Catalog Tools
|
|
130
148
|
listProducts: z.object({
|
|
@@ -198,6 +216,12 @@ export const schemas = {
|
|
|
198
216
|
.enum(["=", "!=", "LIKE", ">", "<", ">=", "<="])
|
|
199
217
|
.default("=")
|
|
200
218
|
.describe("Comparison operator (default: =). Use LIKE for partial name matches with % wildcard."),
|
|
219
|
+
maxResults: z
|
|
220
|
+
.number()
|
|
221
|
+
.int()
|
|
222
|
+
.min(1)
|
|
223
|
+
.optional()
|
|
224
|
+
.describe("Maximum number of accounts to return. When specified, results are truncated server-side to exactly this count. Supports any count including values beyond the 2000-per-page ZOQL limit via auto-pagination. Omit to return all matching records."),
|
|
201
225
|
}),
|
|
202
226
|
listUsage: z.object({
|
|
203
227
|
accountKey: z
|
|
@@ -835,6 +859,27 @@ export const schemas = {
|
|
|
835
859
|
.string()
|
|
836
860
|
.min(1)
|
|
837
861
|
.describe("Account number or ID (e.g., A00012345)"),
|
|
862
|
+
maxInvoices: z
|
|
863
|
+
.number()
|
|
864
|
+
.int()
|
|
865
|
+
.min(1)
|
|
866
|
+
.optional()
|
|
867
|
+
.default(20)
|
|
868
|
+
.describe("Maximum number of recent invoices to fetch (default: 20)."),
|
|
869
|
+
maxPayments: z
|
|
870
|
+
.number()
|
|
871
|
+
.int()
|
|
872
|
+
.min(1)
|
|
873
|
+
.optional()
|
|
874
|
+
.default(10)
|
|
875
|
+
.describe("Maximum number of recent payments to fetch (default: 10)."),
|
|
876
|
+
maxSubscriptions: z
|
|
877
|
+
.number()
|
|
878
|
+
.int()
|
|
879
|
+
.min(1)
|
|
880
|
+
.optional()
|
|
881
|
+
.default(10)
|
|
882
|
+
.describe("Maximum number of active subscriptions to include (default: 10)."),
|
|
838
883
|
}),
|
|
839
884
|
getRevenueByProduct: z.object({
|
|
840
885
|
limit: z
|
|
@@ -1011,13 +1056,23 @@ export class ToolHandlers {
|
|
|
1011
1056
|
}
|
|
1012
1057
|
async listSubscriptions(input) {
|
|
1013
1058
|
try {
|
|
1014
|
-
const { accountKey } = schemas.listSubscriptions.parse(input);
|
|
1059
|
+
const { accountKey, maxResults } = schemas.listSubscriptions.parse(input);
|
|
1015
1060
|
const result = await this.client.listSubscriptionsByAccount(accountKey);
|
|
1016
|
-
const
|
|
1061
|
+
const allSubs = result.subscriptions ?? [];
|
|
1062
|
+
const subscriptions = maxResults !== undefined
|
|
1063
|
+
? allSubs.slice(0, maxResults)
|
|
1064
|
+
: allSubs;
|
|
1017
1065
|
return {
|
|
1018
1066
|
success: true,
|
|
1019
|
-
message:
|
|
1020
|
-
|
|
1067
|
+
message: maxResults !== undefined && allSubs.length > maxResults
|
|
1068
|
+
? `Returning ${subscriptions.length} of ${allSubs.length} subscription(s) for account ${accountKey}`
|
|
1069
|
+
: `Found ${subscriptions.length} subscription(s) for account ${accountKey}`,
|
|
1070
|
+
data: {
|
|
1071
|
+
subscriptions,
|
|
1072
|
+
...(maxResults !== undefined && allSubs.length > maxResults
|
|
1073
|
+
? { totalAvailable: allSubs.length }
|
|
1074
|
+
: {}),
|
|
1075
|
+
},
|
|
1021
1076
|
};
|
|
1022
1077
|
}
|
|
1023
1078
|
catch (error) {
|
|
@@ -1071,7 +1126,22 @@ export class ToolHandlers {
|
|
|
1071
1126
|
// --- ZOQL Query Handlers ---
|
|
1072
1127
|
async executeZoqlQuery(input) {
|
|
1073
1128
|
try {
|
|
1074
|
-
const { zoqlQuery } = schemas.executeZoqlQuery.parse(input);
|
|
1129
|
+
const { zoqlQuery, maxResults } = schemas.executeZoqlQuery.parse(input);
|
|
1130
|
+
if (maxResults !== undefined) {
|
|
1131
|
+
// Auto-paginate and truncate to exact count requested
|
|
1132
|
+
const allRecords = await this.client.queryAll(zoqlQuery, maxResults);
|
|
1133
|
+
const records = allRecords.slice(0, maxResults);
|
|
1134
|
+
return {
|
|
1135
|
+
success: true,
|
|
1136
|
+
message: `Returning ${records.length} record(s)`,
|
|
1137
|
+
data: {
|
|
1138
|
+
size: records.length,
|
|
1139
|
+
records,
|
|
1140
|
+
done: true,
|
|
1141
|
+
},
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
// No maxResults — return first page as before
|
|
1075
1145
|
const result = await this.client.executeQuery(zoqlQuery);
|
|
1076
1146
|
const moreAvailable = result.queryLocator
|
|
1077
1147
|
? " (more available via continue_zoql_query)"
|
|
@@ -1091,8 +1161,25 @@ export class ToolHandlers {
|
|
|
1091
1161
|
}
|
|
1092
1162
|
async continueZoqlQuery(input) {
|
|
1093
1163
|
try {
|
|
1094
|
-
const { queryLocator } = schemas.continueZoqlQuery.parse(input);
|
|
1164
|
+
const { queryLocator, maxResults } = schemas.continueZoqlQuery.parse(input);
|
|
1095
1165
|
const result = await this.client.queryMore(queryLocator);
|
|
1166
|
+
if (maxResults !== undefined) {
|
|
1167
|
+
const allRecords = result.records ?? [];
|
|
1168
|
+
const records = allRecords.slice(0, maxResults);
|
|
1169
|
+
const moreAvailable = (allRecords.length > maxResults || result.queryLocator)
|
|
1170
|
+
? " (more available)"
|
|
1171
|
+
: "";
|
|
1172
|
+
return {
|
|
1173
|
+
success: true,
|
|
1174
|
+
message: `Continuation returned ${records.length} record(s)${moreAvailable}`,
|
|
1175
|
+
data: {
|
|
1176
|
+
size: records.length,
|
|
1177
|
+
records,
|
|
1178
|
+
queryLocator: result.queryLocator,
|
|
1179
|
+
done: result.done,
|
|
1180
|
+
},
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1096
1183
|
const moreAvailable = result.queryLocator
|
|
1097
1184
|
? " (more available)"
|
|
1098
1185
|
: "";
|
|
@@ -1185,7 +1272,21 @@ export class ToolHandlers {
|
|
|
1185
1272
|
}
|
|
1186
1273
|
async searchAccounts(input) {
|
|
1187
1274
|
try {
|
|
1188
|
-
const { field, value, operator } = schemas.searchAccounts.parse(input);
|
|
1275
|
+
const { field, value, operator, maxResults } = schemas.searchAccounts.parse(input);
|
|
1276
|
+
if (maxResults !== undefined) {
|
|
1277
|
+
// Use queryAll for auto-pagination, then truncate to exact count
|
|
1278
|
+
const allRecords = await this.client.searchAccountsWithLimit(field, value, operator, maxResults);
|
|
1279
|
+
return {
|
|
1280
|
+
success: true,
|
|
1281
|
+
message: `Returning ${allRecords.length} account(s) matching search criteria`,
|
|
1282
|
+
data: {
|
|
1283
|
+
size: allRecords.length,
|
|
1284
|
+
records: allRecords,
|
|
1285
|
+
done: true,
|
|
1286
|
+
},
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
// No maxResults — return full result as before
|
|
1189
1290
|
const result = await this.client.searchAccounts(field, value, operator);
|
|
1190
1291
|
const count = result.records?.length ?? 0;
|
|
1191
1292
|
return {
|
|
@@ -1355,7 +1456,7 @@ export class ToolHandlers {
|
|
|
1355
1456
|
});
|
|
1356
1457
|
return {
|
|
1357
1458
|
success: true,
|
|
1358
|
-
message: `Applied payment ${result.
|
|
1459
|
+
message: `Applied payment ${paymentId} (applied: ${result.appliedAmount}) successfully`,
|
|
1359
1460
|
data: result,
|
|
1360
1461
|
};
|
|
1361
1462
|
}
|
|
@@ -1668,7 +1769,7 @@ export class ToolHandlers {
|
|
|
1668
1769
|
// Query overdue invoices: Posted, has balance, past due date
|
|
1669
1770
|
const invoices = await queryAll(this.client, `SELECT Id, InvoiceNumber, AccountId, InvoiceDate, DueDate, Amount, Balance ` +
|
|
1670
1771
|
`FROM Invoice ` +
|
|
1671
|
-
`WHERE Status = 'Posted' AND Balance > ${minBalance} AND DueDate < '${today}'`, limit);
|
|
1772
|
+
`WHERE Status = 'Posted' AND Balance > ${Number(minBalance)} AND DueDate < '${today}'`, limit);
|
|
1672
1773
|
if (invoices.length === 0) {
|
|
1673
1774
|
return {
|
|
1674
1775
|
success: true,
|
|
@@ -1765,7 +1866,7 @@ export class ToolHandlers {
|
|
|
1765
1866
|
accountName: getString(acct ?? {}, "Name") ?? "",
|
|
1766
1867
|
status: getString(sub, "Status") ?? "",
|
|
1767
1868
|
termEndDate: termEnd,
|
|
1768
|
-
autoRenew: sub
|
|
1869
|
+
autoRenew: getString(sub, "AutoRenew") === "true",
|
|
1769
1870
|
contractedMrr: getNumber(sub, "ContractedMrr") ?? 0,
|
|
1770
1871
|
ratePlanNames: rpNamesBySub.get(subId) ?? [],
|
|
1771
1872
|
daysUntilExpiry: daysBetween(today, termEnd),
|
|
@@ -1794,17 +1895,17 @@ export class ToolHandlers {
|
|
|
1794
1895
|
}
|
|
1795
1896
|
async getAccountBillingOverview(input) {
|
|
1796
1897
|
try {
|
|
1797
|
-
const { accountKey } = schemas.getAccountBillingOverview.parse(input);
|
|
1898
|
+
const { accountKey, maxInvoices, maxPayments, maxSubscriptions } = schemas.getAccountBillingOverview.parse(input);
|
|
1798
1899
|
// Step 1: Get account via REST API
|
|
1799
1900
|
const account = await this.client.getAccount(accountKey);
|
|
1800
1901
|
// Step 2: Get recent invoices via ZOQL
|
|
1801
1902
|
const invoices = await queryAll(this.client, `SELECT Id, InvoiceNumber, InvoiceDate, DueDate, Amount, Balance, Status ` +
|
|
1802
1903
|
`FROM Invoice WHERE AccountId = '${escapeZoql(account.id)}' ` +
|
|
1803
|
-
`ORDER BY InvoiceDate DESC`,
|
|
1904
|
+
`ORDER BY InvoiceDate DESC`, maxInvoices);
|
|
1804
1905
|
// Step 3: Get recent payments via ZOQL
|
|
1805
1906
|
const payments = await queryAll(this.client, `SELECT Id, PaymentNumber, Amount, EffectiveDate, Status ` +
|
|
1806
1907
|
`FROM Payment WHERE AccountId = '${escapeZoql(account.id)}' ` +
|
|
1807
|
-
`ORDER BY EffectiveDate DESC`,
|
|
1908
|
+
`ORDER BY EffectiveDate DESC`, maxPayments);
|
|
1808
1909
|
// Step 4: Get subscriptions via REST API
|
|
1809
1910
|
const subResult = await this.client.listSubscriptionsByAccount(accountKey);
|
|
1810
1911
|
const subscriptions = subResult.subscriptions ?? [];
|
|
@@ -1842,7 +1943,7 @@ export class ToolHandlers {
|
|
|
1842
1943
|
totalOutstanding,
|
|
1843
1944
|
overdueCount,
|
|
1844
1945
|
overdueAmount,
|
|
1845
|
-
recentInvoices: invoices.slice(0,
|
|
1946
|
+
recentInvoices: invoices.slice(0, maxInvoices).map((inv) => ({
|
|
1846
1947
|
invoiceNumber: getString(inv, "InvoiceNumber") ?? "",
|
|
1847
1948
|
invoiceDate: getString(inv, "InvoiceDate") ?? "",
|
|
1848
1949
|
dueDate: getString(inv, "DueDate") ?? "",
|
|
@@ -1852,7 +1953,7 @@ export class ToolHandlers {
|
|
|
1852
1953
|
})),
|
|
1853
1954
|
},
|
|
1854
1955
|
paymentSummary: {
|
|
1855
|
-
recentPayments: payments.slice(0,
|
|
1956
|
+
recentPayments: payments.slice(0, maxPayments).map((p) => ({
|
|
1856
1957
|
paymentNumber: getString(p, "PaymentNumber") ?? "",
|
|
1857
1958
|
amount: getNumber(p, "Amount") ?? 0,
|
|
1858
1959
|
effectiveDate: getString(p, "EffectiveDate") ?? "",
|
|
@@ -1862,7 +1963,7 @@ export class ToolHandlers {
|
|
|
1862
1963
|
subscriptionSummary: {
|
|
1863
1964
|
activeCount: activeSubscriptions.length,
|
|
1864
1965
|
totalMrr,
|
|
1865
|
-
subscriptions: activeSubscriptions.slice(0,
|
|
1966
|
+
subscriptions: activeSubscriptions.slice(0, maxSubscriptions).map((s) => ({
|
|
1866
1967
|
subscriptionNumber: s.subscriptionNumber,
|
|
1867
1968
|
status: s.status,
|
|
1868
1969
|
termEndDate: s.termEndDate,
|
|
@@ -1888,7 +1989,7 @@ export class ToolHandlers {
|
|
|
1888
1989
|
try {
|
|
1889
1990
|
const { limit } = schemas.getRevenueByProduct.parse(input);
|
|
1890
1991
|
// Step 1: Get all active subscriptions with MRR
|
|
1891
|
-
const subscriptions = await queryAll(this.client, `SELECT Id, AccountId, SubscriptionNumber, ContractedMrr, Status ` +
|
|
1992
|
+
const subscriptions = await queryAll(this.client, `SELECT Id, AccountId, SubscriptionNumber, ContractedMrr, TotalContractedValue, Status ` +
|
|
1892
1993
|
`FROM Subscription WHERE Status = 'Active'`, 5000);
|
|
1893
1994
|
if (subscriptions.length === 0) {
|
|
1894
1995
|
return {
|
|
@@ -1937,6 +2038,7 @@ export class ToolHandlers {
|
|
|
1937
2038
|
};
|
|
1938
2039
|
existing.subscriptionCount++;
|
|
1939
2040
|
existing.totalMrr += mrr;
|
|
2041
|
+
existing.totalTcv += getNumber(sub, "TotalContractedValue") ?? 0;
|
|
1940
2042
|
existing.subscriptions.push({
|
|
1941
2043
|
subscriptionNumber: getString(sub, "SubscriptionNumber") ?? "",
|
|
1942
2044
|
accountNumber: getString(acct ?? {}, "AccountNumber") ?? "",
|
|
@@ -2042,9 +2144,9 @@ export class ToolHandlers {
|
|
|
2042
2144
|
try {
|
|
2043
2145
|
const { daysBack, limit } = schemas.getRecentlyCancelledSubscriptions.parse(input);
|
|
2044
2146
|
const sinceDate = subtractDays(new Date(), daysBack);
|
|
2045
|
-
const subscriptions = await queryAll(this.client, `SELECT Id, SubscriptionNumber, AccountId, Status, TermEndDate,
|
|
2147
|
+
const subscriptions = await queryAll(this.client, `SELECT Id, SubscriptionNumber, AccountId, Status, TermEndDate, CancelledDate, ContractedMrr ` +
|
|
2046
2148
|
`FROM Subscription ` +
|
|
2047
|
-
`WHERE Status = 'Cancelled' AND
|
|
2149
|
+
`WHERE Status = 'Cancelled' AND CancelledDate >= '${sinceDate}'`, limit * 2);
|
|
2048
2150
|
if (subscriptions.length === 0) {
|
|
2049
2151
|
return {
|
|
2050
2152
|
success: true,
|
|
@@ -2079,7 +2181,7 @@ export class ToolHandlers {
|
|
|
2079
2181
|
accountNumber: getString(acct ?? {}, "AccountNumber") ?? "",
|
|
2080
2182
|
accountName: getString(acct ?? {}, "Name") ?? "",
|
|
2081
2183
|
status: getString(sub, "Status") ?? "",
|
|
2082
|
-
cancelledDate: getString(sub, "
|
|
2184
|
+
cancelledDate: getString(sub, "CancelledDate") ?? "",
|
|
2083
2185
|
termEndDate: getString(sub, "TermEndDate") ?? "",
|
|
2084
2186
|
contractedMrr: getNumber(sub, "ContractedMrr") ?? 0,
|
|
2085
2187
|
ratePlanNames: rpNamesBySub.get(subId) ?? [],
|
|
@@ -2194,7 +2296,7 @@ export class ToolHandlers {
|
|
|
2194
2296
|
// Signal 2: Expiring subscriptions (next 30 days, not auto-renewing)
|
|
2195
2297
|
const expiringSubscriptions = await queryAll(this.client, `SELECT Id, AccountId, ContractedMrr, TermEndDate ` +
|
|
2196
2298
|
`FROM Subscription ` +
|
|
2197
|
-
`WHERE Status = 'Active' AND TermEndDate >= '${today}' AND TermEndDate <= '${thirtyDaysAhead}' AND AutoRenew = false`, 2000);
|
|
2299
|
+
`WHERE Status = 'Active' AND TermEndDate >= '${today}' AND TermEndDate <= '${thirtyDaysAhead}' AND AutoRenew = 'false'`, 2000);
|
|
2198
2300
|
// Signal 3: Recent payment failures
|
|
2199
2301
|
const failedPayments = await queryAll(this.client, `SELECT Id, AccountId ` +
|
|
2200
2302
|
`FROM Payment ` +
|
|
@@ -2346,7 +2448,7 @@ export class ToolHandlers {
|
|
|
2346
2448
|
}
|
|
2347
2449
|
const rpcIds = collectIds(ratePlanCharges, "Id");
|
|
2348
2450
|
// Step 3: Find InvoiceItems by RatePlanChargeId
|
|
2349
|
-
const invoiceItems = await queryWithBatchedIds(this.client, "Id, InvoiceId, ChargeAmount, ChargeName, ServiceStartDate, ServiceEndDate, SubscriptionId", "InvoiceItem", "RatePlanChargeId", rpcIds, undefined, limit);
|
|
2451
|
+
const invoiceItems = await queryWithBatchedIds(this.client, "Id, InvoiceId, ChargeAmount, ChargeName, ServiceStartDate, ServiceEndDate, SubscriptionId, RatePlanChargeId", "InvoiceItem", "RatePlanChargeId", rpcIds, undefined, limit);
|
|
2350
2452
|
if (invoiceItems.length === 0) {
|
|
2351
2453
|
return {
|
|
2352
2454
|
success: true,
|
|
@@ -2449,7 +2551,8 @@ export const toolRegistrations = [
|
|
|
2449
2551
|
{
|
|
2450
2552
|
name: "list_subscriptions",
|
|
2451
2553
|
description: "List all subscriptions for a Zuora account. " +
|
|
2452
|
-
"Returns subscription names, statuses, and term dates."
|
|
2554
|
+
"Returns subscription names, statuses, and term dates. " +
|
|
2555
|
+
"Use the maxResults parameter when the user requests a specific number of subscriptions.",
|
|
2453
2556
|
inputSchema: schemas.listSubscriptions,
|
|
2454
2557
|
invoke: (handlers, args) => handlers.listSubscriptions(args),
|
|
2455
2558
|
},
|
|
@@ -2475,8 +2578,9 @@ export const toolRegistrations = [
|
|
|
2475
2578
|
"Syntax: SELECT field1, field2 FROM ObjectName WHERE condition. " +
|
|
2476
2579
|
"Key objects: Account, Invoice, Payment, Subscription, RatePlan, " +
|
|
2477
2580
|
"RatePlanCharge, Product, ProductRatePlan, Contact. " +
|
|
2478
|
-
"Limitations: No JOINs supported.
|
|
2479
|
-
"
|
|
2581
|
+
"Limitations: No JOINs supported. ZOQL has no LIMIT clause — use the maxResults " +
|
|
2582
|
+
"parameter to control how many records are returned (e.g., maxResults=10). " +
|
|
2583
|
+
"Use continue_zoql_query with queryLocator for manual pagination when maxResults is not set. " +
|
|
2480
2584
|
"Example: SELECT Id, AccountNumber, Name, Balance FROM Account WHERE Status = 'Active'",
|
|
2481
2585
|
inputSchema: schemas.executeZoqlQuery,
|
|
2482
2586
|
invoke: (handlers, args) => handlers.executeZoqlQuery(args),
|
|
@@ -2484,7 +2588,8 @@ export const toolRegistrations = [
|
|
|
2484
2588
|
{
|
|
2485
2589
|
name: "continue_zoql_query",
|
|
2486
2590
|
description: "Continue a previous ZOQL query that returned a queryLocator " +
|
|
2487
|
-
"(indicates more records available). Returns the next batch of up to 2000 records."
|
|
2591
|
+
"(indicates more records available). Returns the next batch of up to 2000 records. " +
|
|
2592
|
+
"Use the maxResults parameter to return fewer records from the continuation page.",
|
|
2488
2593
|
inputSchema: schemas.continueZoqlQuery,
|
|
2489
2594
|
invoke: (handlers, args) => handlers.continueZoqlQuery(args),
|
|
2490
2595
|
},
|
|
@@ -2528,6 +2633,8 @@ export const toolRegistrations = [
|
|
|
2528
2633
|
"AccountNumber, Status, Currency, or Balance. Use LIKE operator with % " +
|
|
2529
2634
|
"wildcard for partial name matching (e.g., field='Name', operator='LIKE', " +
|
|
2530
2635
|
"value='Acme%'). Returns Id, AccountNumber, Name, Status, Balance, Currency. " +
|
|
2636
|
+
"Use the maxResults parameter when the user requests a specific number of records " +
|
|
2637
|
+
"(e.g., 'get 10 active accounts' → maxResults=10). " +
|
|
2531
2638
|
"For additional fields, use execute_zoql_query directly.",
|
|
2532
2639
|
inputSchema: schemas.searchAccounts,
|
|
2533
2640
|
invoke: (handlers, args) => handlers.searchAccounts(args),
|