mcp-zenskar 1.1.7 → 1.1.9
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/README.md +16 -17
- package/package.json +1 -1
- package/src/mcp-config.json +122 -240
- package/src/response-processor.js +2 -2
- package/src/server.js +206 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ MCP server for the Zenskar API. 103 tools covering customers, contracts, invoice
|
|
|
8
8
|
- Contracts: create, read, update, delete, amend, add phases and pricing, expire
|
|
9
9
|
- Invoices: list, get, approve, void, generate, credit notes, download
|
|
10
10
|
- Payments: create, edit, refund, delete, auto-charge
|
|
11
|
-
- Credit notes: list, create
|
|
11
|
+
- Credit notes: list, create against invoice, get by ID
|
|
12
12
|
- Accounting: chart of accounts, journal entries and lines, balance sheet, income statement, account balances
|
|
13
13
|
- Products: CRUD, pricing configurations
|
|
14
14
|
- Plans: list, create, add products, preview estimates
|
|
@@ -124,9 +124,9 @@ Once configured, you can ask Claude to interact with your Zenskar data:
|
|
|
124
124
|
| `getInvoiceGenerationStatus` | Check invoice generation status |
|
|
125
125
|
| `downloadInvoice` | Download invoice in JSON format |
|
|
126
126
|
| `getInvoiceContractJsonActuals` | Get contract actuals for an invoice |
|
|
127
|
-
| `getInvoicePayments` | Get payments
|
|
128
|
-
| `getInvoicePaymentsById` | Get
|
|
129
|
-
| `getInvoicePaymentsWithoutRefunds` | Get invoice
|
|
127
|
+
| `getInvoicePayments` | Get successful payments currently mapped to an invoice |
|
|
128
|
+
| `getInvoicePaymentsById` | Get successful payments for a specific invoice ID |
|
|
129
|
+
| `getInvoicePaymentsWithoutRefunds` | Get original payment records for an invoice, excluding refund payment rows |
|
|
130
130
|
| `getInvoiceLineItems` | Get invoice line items and pricing details |
|
|
131
131
|
| `getInvoiceSummary` | Get invoice summary |
|
|
132
132
|
| `getAllInvoiceTags` | Get all available invoice tags |
|
|
@@ -141,10 +141,10 @@ Once configured, you can ask Claude to interact with your Zenskar data:
|
|
|
141
141
|
### Payments
|
|
142
142
|
| Tool | Description |
|
|
143
143
|
|---|---|
|
|
144
|
-
| `listAllPayments` | List all payments with filtering and sorting |
|
|
144
|
+
| `listAllPayments` | List all payments with filtering and sorting, including refund records |
|
|
145
145
|
| `getPaymentById` | Get a payment by ID |
|
|
146
146
|
| `createPayment` | Record a payment against an invoice |
|
|
147
|
-
| `updatePayment` | Update a payment's
|
|
147
|
+
| `updatePayment` | Update a payment's invoice allocations (`payment_parts`) |
|
|
148
148
|
| `deleteManualPayment` | Delete a manual payment |
|
|
149
149
|
| `editManualPayment` | Edit a manual payment's amount or method |
|
|
150
150
|
| `refundPayment` | Refund a payment (full or partial) |
|
|
@@ -154,7 +154,6 @@ Once configured, you can ask Claude to interact with your Zenskar data:
|
|
|
154
154
|
|---|---|
|
|
155
155
|
| `listCreditNotes` | List credit notes with pagination |
|
|
156
156
|
| `getCreditNoteById` | Get a credit note by ID |
|
|
157
|
-
| `createCreditNote` | Create a standalone credit note |
|
|
158
157
|
|
|
159
158
|
### Products and Pricing
|
|
160
159
|
| Tool | Description |
|
|
@@ -232,16 +231,16 @@ Once configured, you can ask Claude to interact with your Zenskar data:
|
|
|
232
231
|
### Metrics and Usage Events
|
|
233
232
|
| Tool | Description |
|
|
234
233
|
|---|---|
|
|
235
|
-
| `listAggregates` | List
|
|
236
|
-
| `getAggregateSchemas` |
|
|
237
|
-
| `getAggregateEstimates` | Get
|
|
238
|
-
| `getAggregateById` | Get a
|
|
239
|
-
| `getAggregateLogs` | Get logs for a
|
|
240
|
-
| `listRawMetrics` | List
|
|
241
|
-
| `createRawMetric` | Create a
|
|
242
|
-
| `getRawMetricById` | Get a
|
|
243
|
-
| `getRawMetricLogs` | Get logs for a
|
|
244
|
-
| `getRawMetricBySlug` | Get a
|
|
234
|
+
| `listAggregates` | List Billable Metrics with filtering; backend/API may also call these aggregates |
|
|
235
|
+
| `getAggregateSchemas` | Show the underlying schemas for Billable Metrics (Aggregates); mainly useful for debugging or integration work |
|
|
236
|
+
| `getAggregateEstimates` | Get Billable Metric estimates; backend/API may also call these aggregates |
|
|
237
|
+
| `getAggregateById` | Get a Billable Metric by ID; backend/API may also call it an aggregate |
|
|
238
|
+
| `getAggregateLogs` | Get logs for a Billable Metric (Aggregate) |
|
|
239
|
+
| `listRawMetrics` | List Usage Events with filtering; backend/API may also call these raw metrics |
|
|
240
|
+
| `createRawMetric` | Create a Usage Event schema; backend/API calls this a raw metric |
|
|
241
|
+
| `getRawMetricById` | Get a Usage Event by ID; backend/API may also call it a raw metric |
|
|
242
|
+
| `getRawMetricLogs` | Get logs for a Usage Event (raw metric) |
|
|
243
|
+
| `getRawMetricBySlug` | Get a Usage Event by API slug; backend/API may also call it a raw metric |
|
|
245
244
|
| `ingestRawMetricEvent` | Ingest a usage event |
|
|
246
245
|
|
|
247
246
|
### Other
|
package/package.json
CHANGED
package/src/mcp-config.json
CHANGED
|
@@ -72,13 +72,6 @@
|
|
|
72
72
|
"required": false,
|
|
73
73
|
"position": "query"
|
|
74
74
|
},
|
|
75
|
-
{
|
|
76
|
-
"name": "id__ilike",
|
|
77
|
-
"description": "Case-insensitive partial match for customer ID.",
|
|
78
|
-
"type": "string",
|
|
79
|
-
"required": false,
|
|
80
|
-
"position": "query"
|
|
81
|
-
},
|
|
82
75
|
{
|
|
83
76
|
"name": "id__in",
|
|
84
77
|
"description": "Filter by a comma-separated list of customer IDs.",
|
|
@@ -279,8 +272,8 @@
|
|
|
279
272
|
"position": "query"
|
|
280
273
|
},
|
|
281
274
|
{
|
|
282
|
-
"name": "
|
|
283
|
-
"description": "Filter invoices by a customer's external ID.",
|
|
275
|
+
"name": "customer__external_id",
|
|
276
|
+
"description": "Filter invoices by a customer's external ID (nested filter).",
|
|
284
277
|
"type": "string",
|
|
285
278
|
"required": false,
|
|
286
279
|
"position": "query"
|
|
@@ -428,9 +421,9 @@
|
|
|
428
421
|
"position": "path"
|
|
429
422
|
},
|
|
430
423
|
{
|
|
431
|
-
"name": "
|
|
432
|
-
"description": "
|
|
433
|
-
"type": "
|
|
424
|
+
"name": "include_line_items",
|
|
425
|
+
"description": "Whether to include line items in the response.",
|
|
426
|
+
"type": "boolean",
|
|
434
427
|
"required": false,
|
|
435
428
|
"position": "query"
|
|
436
429
|
}
|
|
@@ -502,7 +495,7 @@
|
|
|
502
495
|
"position": "path"
|
|
503
496
|
},
|
|
504
497
|
{
|
|
505
|
-
"name": "
|
|
498
|
+
"name": "invoice_json_key",
|
|
506
499
|
"description": "Optional key for invoice JSON.",
|
|
507
500
|
"type": "string",
|
|
508
501
|
"required": false,
|
|
@@ -546,7 +539,7 @@
|
|
|
546
539
|
},
|
|
547
540
|
{
|
|
548
541
|
"name": "getInvoicePayments",
|
|
549
|
-
"description": "Get payments associated with a specific invoice.",
|
|
542
|
+
"description": "Get successful payments currently associated with a specific invoice. This view may omit refund records and non-success payment states.",
|
|
550
543
|
"args": [
|
|
551
544
|
{
|
|
552
545
|
"name": "invoiceId",
|
|
@@ -677,7 +670,7 @@
|
|
|
677
670
|
},
|
|
678
671
|
{
|
|
679
672
|
"name": "listAggregates",
|
|
680
|
-
"description": "
|
|
673
|
+
"description": "List Billable Metrics (also called aggregates in backend/API terminology) in paginated form, with filtering by ID, name, and data source.",
|
|
681
674
|
"args": [
|
|
682
675
|
{
|
|
683
676
|
"name": "cursor",
|
|
@@ -751,28 +744,28 @@
|
|
|
751
744
|
"method": "GET"
|
|
752
745
|
},
|
|
753
746
|
"responseTemplate": {
|
|
754
|
-
"prependBody": "## Billable Metrics
|
|
747
|
+
"prependBody": "## Billable Metrics (Aggregates)\n\nHere is the list of billable metrics. Backend/API terminology may also call these aggregates:\n\n"
|
|
755
748
|
}
|
|
756
749
|
},
|
|
757
750
|
{
|
|
758
751
|
"name": "getAggregateSchemas",
|
|
759
|
-
"description": "
|
|
752
|
+
"description": "Show the underlying storage/schema definitions for Billable Metrics (also called aggregates). Mainly useful for advanced debugging, SQL/schema inspection, and integration work rather than day-to-day business operations.",
|
|
760
753
|
"args": [],
|
|
761
754
|
"requestTemplate": {
|
|
762
755
|
"url": "/aggregates/tables/schema",
|
|
763
756
|
"method": "GET"
|
|
764
757
|
},
|
|
765
758
|
"responseTemplate": {
|
|
766
|
-
"prependBody": "## Billable Metric Schemas\n\nHere are the schemas for billable metrics:\n\n"
|
|
759
|
+
"prependBody": "## Billable Metric Schemas\n\nHere are the underlying schemas for billable metrics (aggregates):\n\n"
|
|
767
760
|
}
|
|
768
761
|
},
|
|
769
762
|
{
|
|
770
763
|
"name": "getAggregateEstimates",
|
|
771
|
-
"description": "Get
|
|
764
|
+
"description": "Get Billable Metric estimates based on the specified criteria. Backend/API terminology may also call a billable metric an aggregate.",
|
|
772
765
|
"args": [
|
|
773
766
|
{
|
|
774
767
|
"name": "aggregate_id",
|
|
775
|
-
"description": "The ID of the
|
|
768
|
+
"description": "The ID of the Billable Metric (aggregate).",
|
|
776
769
|
"type": "string",
|
|
777
770
|
"required": true,
|
|
778
771
|
"position": "query"
|
|
@@ -812,16 +805,16 @@
|
|
|
812
805
|
"method": "GET"
|
|
813
806
|
},
|
|
814
807
|
"responseTemplate": {
|
|
815
|
-
"prependBody": "## Billable Metric Estimates\n\nHere are the estimates for the
|
|
808
|
+
"prependBody": "## Billable Metric Estimates\n\nHere are the estimates for the Billable Metric (aggregate):\n\n"
|
|
816
809
|
}
|
|
817
810
|
},
|
|
818
811
|
{
|
|
819
812
|
"name": "getAggregateById",
|
|
820
|
-
"description": "Get the details of a
|
|
813
|
+
"description": "Get the details of a Billable Metric by its ID. Backend/API terminology may also call this an aggregate.",
|
|
821
814
|
"args": [
|
|
822
815
|
{
|
|
823
816
|
"name": "aggregateId",
|
|
824
|
-
"description": "The ID of the
|
|
817
|
+
"description": "The ID of the Billable Metric (aggregate).",
|
|
825
818
|
"type": "string",
|
|
826
819
|
"required": true,
|
|
827
820
|
"position": "path"
|
|
@@ -832,16 +825,16 @@
|
|
|
832
825
|
"method": "GET"
|
|
833
826
|
},
|
|
834
827
|
"responseTemplate": {
|
|
835
|
-
"prependBody": "## Billable Metric Details\n\nHere are the details for the specified
|
|
828
|
+
"prependBody": "## Billable Metric Details\n\nHere are the details for the specified Billable Metric (aggregate):\n\n"
|
|
836
829
|
}
|
|
837
830
|
},
|
|
838
831
|
{
|
|
839
832
|
"name": "getAggregateLogs",
|
|
840
|
-
"description": "Get
|
|
833
|
+
"description": "Get logs related to a Billable Metric (also called an aggregate) by ID, with optional date and customer filters.",
|
|
841
834
|
"args": [
|
|
842
835
|
{
|
|
843
836
|
"name": "aggregateId",
|
|
844
|
-
"description": "The ID of the
|
|
837
|
+
"description": "The ID of the Billable Metric (aggregate).",
|
|
845
838
|
"type": "string",
|
|
846
839
|
"required": true,
|
|
847
840
|
"position": "path"
|
|
@@ -888,12 +881,12 @@
|
|
|
888
881
|
"method": "GET"
|
|
889
882
|
},
|
|
890
883
|
"responseTemplate": {
|
|
891
|
-
"prependBody": "## Billable Metric Logs\n\nHere are the logs for the specified
|
|
884
|
+
"prependBody": "## Billable Metric Logs\n\nHere are the logs for the specified Billable Metric (aggregate):\n\n"
|
|
892
885
|
}
|
|
893
886
|
},
|
|
894
887
|
{
|
|
895
888
|
"name": "listRawMetrics",
|
|
896
|
-
"description": "
|
|
889
|
+
"description": "List Usage Events. In backend/API terminology these are also called raw metrics. Supports filtering by ID, name, and API slug.",
|
|
897
890
|
"args": [
|
|
898
891
|
{
|
|
899
892
|
"name": "cursor",
|
|
@@ -967,18 +960,18 @@
|
|
|
967
960
|
"method": "GET"
|
|
968
961
|
},
|
|
969
962
|
"responseTemplate": {
|
|
970
|
-
"prependBody": "## Usage Events
|
|
963
|
+
"prependBody": "## Usage Events\n\nHere is the list of usage events. Backend/API terminology may also call these raw metrics:\n\n"
|
|
971
964
|
}
|
|
972
965
|
},
|
|
973
966
|
{
|
|
974
967
|
"name": "createRawMetric",
|
|
975
|
-
"description": "Create a new raw metric
|
|
968
|
+
"description": "Create a new Usage Event schema. In backend/API terminology this resource is called a raw metric. This defines the schema used for ingesting usage events.",
|
|
976
969
|
"needsApproval": true,
|
|
977
970
|
"approvalConfig": {
|
|
978
|
-
"title": "Create
|
|
979
|
-
"description": "This will create a new raw metric and provision its event schema. Please review the payload carefully.",
|
|
971
|
+
"title": "Create Usage Event Schema",
|
|
972
|
+
"description": "This will create a new Usage Event schema (called a raw metric in backend/API terminology) and provision its event schema. Please review the payload carefully.",
|
|
980
973
|
"warningText": "Ensure the dataschema and slug values are correct before continuing.",
|
|
981
|
-
"confirmText": "Create
|
|
974
|
+
"confirmText": "Create Usage Event Schema",
|
|
982
975
|
"cancelText": "Cancel",
|
|
983
976
|
"sensitiveFields": [
|
|
984
977
|
"name",
|
|
@@ -990,37 +983,21 @@
|
|
|
990
983
|
"args": [
|
|
991
984
|
{
|
|
992
985
|
"name": "name",
|
|
993
|
-
"description": "Human-friendly name for the raw metric.",
|
|
986
|
+
"description": "Human-friendly name for the Usage Event schema (raw metric).",
|
|
994
987
|
"type": "string",
|
|
995
988
|
"required": true,
|
|
996
989
|
"position": "body"
|
|
997
990
|
},
|
|
998
991
|
{
|
|
999
992
|
"name": "api_slug",
|
|
1000
|
-
"description": "API slug used when ingesting
|
|
993
|
+
"description": "API slug used when ingesting Usage Events (lowercase, underscores).",
|
|
1001
994
|
"type": "string",
|
|
1002
995
|
"required": true,
|
|
1003
996
|
"position": "body"
|
|
1004
997
|
},
|
|
1005
|
-
{
|
|
1006
|
-
"name": "connector",
|
|
1007
|
-
"description": "Connector that owns this raw metric (e.g., push_to_zenskar).",
|
|
1008
|
-
"type": "string",
|
|
1009
|
-
"required": true,
|
|
1010
|
-
"position": "body",
|
|
1011
|
-
"default": "push_to_zenskar"
|
|
1012
|
-
},
|
|
1013
|
-
{
|
|
1014
|
-
"name": "api_type",
|
|
1015
|
-
"description": "API type for ingestion (typically PUSH).",
|
|
1016
|
-
"type": "string",
|
|
1017
|
-
"required": false,
|
|
1018
|
-
"position": "body",
|
|
1019
|
-
"default": "PUSH"
|
|
1020
|
-
},
|
|
1021
998
|
{
|
|
1022
999
|
"name": "dataschema",
|
|
1023
|
-
"description": "Data schema of raw metric
|
|
1000
|
+
"description": "Data schema of the Usage Event resource (called a raw metric in backend/API terminology). Structure: {\"data\": {custom_fields}, \"timestamp\": \"DateTime64\", \"customer_id\": \"String\"}. The 'timestamp' and 'customer_id' fields are mandatory schema fields for usage ingestion. The 'data' map must include only valid ClickHouse types (String, Int64, Float64, Date32, DateTime64, UUID, Bool); use 'Bool' instead of 'Boolean'.",
|
|
1024
1001
|
"type": "object",
|
|
1025
1002
|
"required": true,
|
|
1026
1003
|
"position": "body",
|
|
@@ -1058,16 +1035,16 @@
|
|
|
1058
1035
|
}
|
|
1059
1036
|
},
|
|
1060
1037
|
"responseTemplate": {
|
|
1061
|
-
"prependBody": "##
|
|
1038
|
+
"prependBody": "## Usage Event Schema Created\n\nThe Usage Event schema (raw metric) was created successfully:\n\n"
|
|
1062
1039
|
}
|
|
1063
1040
|
},
|
|
1064
1041
|
{
|
|
1065
1042
|
"name": "getRawMetricById",
|
|
1066
|
-
"description": "Get
|
|
1043
|
+
"description": "Get Usage Event details by ID. Backend/API terminology may also call this a raw metric.",
|
|
1067
1044
|
"args": [
|
|
1068
1045
|
{
|
|
1069
1046
|
"name": "rawMetricId",
|
|
1070
|
-
"description": "The ID of the raw metric.",
|
|
1047
|
+
"description": "The ID of the Usage Event resource (raw metric).",
|
|
1071
1048
|
"type": "string",
|
|
1072
1049
|
"required": true,
|
|
1073
1050
|
"position": "path"
|
|
@@ -1083,11 +1060,11 @@
|
|
|
1083
1060
|
},
|
|
1084
1061
|
{
|
|
1085
1062
|
"name": "getRawMetricLogs",
|
|
1086
|
-
"description": "Get logs for a specific
|
|
1063
|
+
"description": "Get Usage Event logs for a specific resource by ID. Backend/API terminology may also call this a raw metric.",
|
|
1087
1064
|
"args": [
|
|
1088
1065
|
{
|
|
1089
1066
|
"name": "rawMetricId",
|
|
1090
|
-
"description": "The ID of the raw metric.",
|
|
1067
|
+
"description": "The ID of the Usage Event resource (raw metric).",
|
|
1091
1068
|
"type": "string",
|
|
1092
1069
|
"required": true,
|
|
1093
1070
|
"position": "path"
|
|
@@ -1103,11 +1080,11 @@
|
|
|
1103
1080
|
},
|
|
1104
1081
|
{
|
|
1105
1082
|
"name": "getRawMetricBySlug",
|
|
1106
|
-
"description": "Get
|
|
1083
|
+
"description": "Get Usage Event details by API slug. Backend/API terminology may also call this a raw metric.",
|
|
1107
1084
|
"args": [
|
|
1108
1085
|
{
|
|
1109
1086
|
"name": "rawMetricSlug",
|
|
1110
|
-
"description": "The API slug of the raw metric.",
|
|
1087
|
+
"description": "The API slug of the Usage Event resource (raw metric).",
|
|
1111
1088
|
"type": "string",
|
|
1112
1089
|
"required": true,
|
|
1113
1090
|
"position": "path"
|
|
@@ -1123,7 +1100,7 @@
|
|
|
1123
1100
|
},
|
|
1124
1101
|
{
|
|
1125
1102
|
"name": "getInvoicePaymentsById",
|
|
1126
|
-
"description": "Get payments associated with a specific invoice ID.",
|
|
1103
|
+
"description": "Get successful payments associated with a specific invoice ID. This endpoint is success-only and may not show refund rows.",
|
|
1127
1104
|
"args": [
|
|
1128
1105
|
{
|
|
1129
1106
|
"name": "invoiceId",
|
|
@@ -1143,7 +1120,7 @@
|
|
|
1143
1120
|
},
|
|
1144
1121
|
{
|
|
1145
1122
|
"name": "getInvoicePaymentsWithoutRefunds",
|
|
1146
|
-
"description": "Get
|
|
1123
|
+
"description": "Get original payment records for an invoice, excluding refund payment rows. Refunded or partially refunded original payments may still appear here.",
|
|
1147
1124
|
"args": [
|
|
1148
1125
|
{
|
|
1149
1126
|
"name": "invoiceId",
|
|
@@ -1195,7 +1172,7 @@
|
|
|
1195
1172
|
},
|
|
1196
1173
|
{
|
|
1197
1174
|
"name": "listAllPayments",
|
|
1198
|
-
"description": "Retrieve a paginated list of all payments, with extensive filtering and sorting options.",
|
|
1175
|
+
"description": "Retrieve a paginated list of all payments, including refund records, with extensive filtering and sorting options.",
|
|
1199
1176
|
"args": [
|
|
1200
1177
|
{
|
|
1201
1178
|
"name": "cursor",
|
|
@@ -1472,8 +1449,7 @@
|
|
|
1472
1449
|
"cancelText": "Cancel",
|
|
1473
1450
|
"sensitiveFields": [
|
|
1474
1451
|
"prompt_name",
|
|
1475
|
-
"prompt_text"
|
|
1476
|
-
"document_id"
|
|
1452
|
+
"prompt_text"
|
|
1477
1453
|
]
|
|
1478
1454
|
},
|
|
1479
1455
|
"args": [
|
|
@@ -1491,13 +1467,6 @@
|
|
|
1491
1467
|
"required": true,
|
|
1492
1468
|
"position": "body"
|
|
1493
1469
|
},
|
|
1494
|
-
{
|
|
1495
|
-
"name": "document_id",
|
|
1496
|
-
"description": "The ID of the contract document this prompt is for.",
|
|
1497
|
-
"type": "string",
|
|
1498
|
-
"required": true,
|
|
1499
|
-
"position": "body"
|
|
1500
|
-
},
|
|
1501
1470
|
{
|
|
1502
1471
|
"name": "prompt_schema",
|
|
1503
1472
|
"description": "Optional schema for the prompt (e.g., 'billing_schema'). Can be null.",
|
|
@@ -1553,20 +1522,6 @@
|
|
|
1553
1522
|
"required": false,
|
|
1554
1523
|
"position": "query"
|
|
1555
1524
|
},
|
|
1556
|
-
{
|
|
1557
|
-
"name": "id__ilike",
|
|
1558
|
-
"description": "Contract ID (case-insensitive partial match).",
|
|
1559
|
-
"type": "string",
|
|
1560
|
-
"required": false,
|
|
1561
|
-
"position": "query"
|
|
1562
|
-
},
|
|
1563
|
-
{
|
|
1564
|
-
"name": "id__like",
|
|
1565
|
-
"description": "Contract ID (case-sensitive partial match).",
|
|
1566
|
-
"type": "string",
|
|
1567
|
-
"required": false,
|
|
1568
|
-
"position": "query"
|
|
1569
|
-
},
|
|
1570
1525
|
{
|
|
1571
1526
|
"name": "id__in",
|
|
1572
1527
|
"description": "Filter by a comma-separated list of Contract IDs.",
|
|
@@ -2313,12 +2268,12 @@
|
|
|
2313
2268
|
},
|
|
2314
2269
|
{
|
|
2315
2270
|
"name": "ingestRawMetricEvent",
|
|
2316
|
-
"description": "Ingest a
|
|
2271
|
+
"description": "Ingest a Usage Event for the specified resource slug. Backend/API terminology may also call the target resource a raw metric.",
|
|
2317
2272
|
"needsApproval": true,
|
|
2318
2273
|
"approvalConfig": {
|
|
2319
2274
|
"title": "Ingest Usage Event",
|
|
2320
|
-
"description": "This will ingest a
|
|
2321
|
-
"warningText": "Ensure the data payload matches the raw metric schema before proceeding.",
|
|
2275
|
+
"description": "This will ingest a Usage Event for the selected Usage Event schema (called a raw metric in backend/API terminology). Review the payload carefully.",
|
|
2276
|
+
"warningText": "Ensure the data payload matches the Usage Event schema (raw metric schema) before proceeding.",
|
|
2322
2277
|
"confirmText": "Ingest Usage Event",
|
|
2323
2278
|
"cancelText": "Cancel",
|
|
2324
2279
|
"sensitiveFields": [
|
|
@@ -2329,14 +2284,14 @@
|
|
|
2329
2284
|
"args": [
|
|
2330
2285
|
{
|
|
2331
2286
|
"name": "rawMetricSlug",
|
|
2332
|
-
"description": "Slug of the raw metric
|
|
2287
|
+
"description": "Slug of the Usage Event resource (raw metric), e.g. api_usage_events.",
|
|
2333
2288
|
"type": "string",
|
|
2334
2289
|
"required": true,
|
|
2335
2290
|
"position": "path"
|
|
2336
2291
|
},
|
|
2337
2292
|
{
|
|
2338
2293
|
"name": "event",
|
|
2339
|
-
"description": "Usage
|
|
2294
|
+
"description": "Usage Event payload containing customer_id, timestamp, and a data map with schema-compliant types. customer_id and timestamp are mandatory event fields and must be provided in the payload; MCP does not auto-add them. Before constructing the event, fetch the schema via getRawMetricBySlug (or reuse the response from createRawMetric) so you only include fields that exist in the Usage Event schema (raw metric schema). Use the provided type buckets such as String/Int64 or the exact column names returned by sample logs; do not invent new keys.",
|
|
2340
2295
|
"type": "object",
|
|
2341
2296
|
"required": true,
|
|
2342
2297
|
"position": "body",
|
|
@@ -2449,7 +2404,6 @@
|
|
|
2449
2404
|
"draft",
|
|
2450
2405
|
"active",
|
|
2451
2406
|
"paused",
|
|
2452
|
-
"expired",
|
|
2453
2407
|
"disputed"
|
|
2454
2408
|
]
|
|
2455
2409
|
},
|
|
@@ -2491,15 +2445,15 @@
|
|
|
2491
2445
|
},
|
|
2492
2446
|
{
|
|
2493
2447
|
"name": "renewal_policy",
|
|
2494
|
-
"description": "Contract renewal policy
|
|
2448
|
+
"description": "Contract renewal policy. Currently only 'do_not_renew' is supported at runtime.",
|
|
2495
2449
|
"type": "string",
|
|
2496
2450
|
"required": false,
|
|
2497
2451
|
"position": "body",
|
|
2498
2452
|
"default": "do_not_renew",
|
|
2499
2453
|
"enum": [
|
|
2500
|
-
"
|
|
2501
|
-
"
|
|
2502
|
-
"
|
|
2454
|
+
"renew_with_default_contract",
|
|
2455
|
+
"renew_with_existing",
|
|
2456
|
+
"do_not_renew"
|
|
2503
2457
|
]
|
|
2504
2458
|
},
|
|
2505
2459
|
{
|
|
@@ -2512,9 +2466,9 @@
|
|
|
2512
2466
|
},
|
|
2513
2467
|
{
|
|
2514
2468
|
"name": "phases",
|
|
2515
|
-
"description": "Array of contract phases with pricing details. Each phase includes name, start_date, end_date, phase_type, and pricings array.",
|
|
2469
|
+
"description": "Array of contract phases with pricing details. Each phase includes name, start_date, end_date, phase_type, and pricings array. Defaults to empty array if omitted.",
|
|
2516
2470
|
"type": "array",
|
|
2517
|
-
"required":
|
|
2471
|
+
"required": false,
|
|
2518
2472
|
"position": "body"
|
|
2519
2473
|
},
|
|
2520
2474
|
{
|
|
@@ -2586,7 +2540,7 @@
|
|
|
2586
2540
|
},
|
|
2587
2541
|
{
|
|
2588
2542
|
"name": "status",
|
|
2589
|
-
"description": "Contract status: draft, active, paused,
|
|
2543
|
+
"description": "Contract status: draft, active, paused, or disputed. Cannot set to 'expired' via update.",
|
|
2590
2544
|
"type": "string",
|
|
2591
2545
|
"required": true,
|
|
2592
2546
|
"position": "body",
|
|
@@ -2594,7 +2548,6 @@
|
|
|
2594
2548
|
"draft",
|
|
2595
2549
|
"active",
|
|
2596
2550
|
"paused",
|
|
2597
|
-
"expired",
|
|
2598
2551
|
"disputed"
|
|
2599
2552
|
]
|
|
2600
2553
|
},
|
|
@@ -2656,9 +2609,9 @@
|
|
|
2656
2609
|
},
|
|
2657
2610
|
{
|
|
2658
2611
|
"name": "phases",
|
|
2659
|
-
"description": "
|
|
2612
|
+
"description": "Array of contract phases. Each phase needs at minimum: name, start_date, end_date. Include pricings array if the phase has pricing. Defaults to empty array if omitted.",
|
|
2660
2613
|
"type": "array",
|
|
2661
|
-
"required":
|
|
2614
|
+
"required": false,
|
|
2662
2615
|
"position": "body"
|
|
2663
2616
|
},
|
|
2664
2617
|
{
|
|
@@ -3155,84 +3108,6 @@
|
|
|
3155
3108
|
"prependBody": "## Credit Notes\n\n"
|
|
3156
3109
|
}
|
|
3157
3110
|
},
|
|
3158
|
-
{
|
|
3159
|
-
"name": "createCreditNote",
|
|
3160
|
-
"description": "Create a standalone credit note (not tied to a specific invoice). Status enum: in_progress, issued, void, paid. Repayment method enum: credits, invoice_adjusted, external_payment, credits_against_payment, original_payment_method.",
|
|
3161
|
-
"args": [
|
|
3162
|
-
{
|
|
3163
|
-
"name": "amount",
|
|
3164
|
-
"description": "Credit note amount in the specified currency.",
|
|
3165
|
-
"type": "number",
|
|
3166
|
-
"required": true,
|
|
3167
|
-
"position": "body"
|
|
3168
|
-
},
|
|
3169
|
-
{
|
|
3170
|
-
"name": "currency",
|
|
3171
|
-
"description": "Three-letter ISO 4217 currency code (e.g. USD).",
|
|
3172
|
-
"type": "string",
|
|
3173
|
-
"required": true,
|
|
3174
|
-
"position": "body"
|
|
3175
|
-
},
|
|
3176
|
-
{
|
|
3177
|
-
"name": "customer_id",
|
|
3178
|
-
"description": "UUID of the customer this credit note is for.",
|
|
3179
|
-
"type": "string",
|
|
3180
|
-
"required": true,
|
|
3181
|
-
"position": "body"
|
|
3182
|
-
},
|
|
3183
|
-
{
|
|
3184
|
-
"name": "status",
|
|
3185
|
-
"description": "Credit note status: in_progress, issued, void, or paid.",
|
|
3186
|
-
"type": "string",
|
|
3187
|
-
"required": true,
|
|
3188
|
-
"position": "body",
|
|
3189
|
-
"enum": [
|
|
3190
|
-
"in_progress",
|
|
3191
|
-
"issued",
|
|
3192
|
-
"void",
|
|
3193
|
-
"paid"
|
|
3194
|
-
]
|
|
3195
|
-
},
|
|
3196
|
-
{
|
|
3197
|
-
"name": "repayment_method",
|
|
3198
|
-
"description": "How the credit is applied: credits, invoice_adjusted, external_payment, credits_against_payment, or original_payment_method.",
|
|
3199
|
-
"type": "string",
|
|
3200
|
-
"required": true,
|
|
3201
|
-
"position": "body",
|
|
3202
|
-
"enum": [
|
|
3203
|
-
"credits",
|
|
3204
|
-
"invoice_adjusted",
|
|
3205
|
-
"external_payment",
|
|
3206
|
-
"credits_against_payment",
|
|
3207
|
-
"original_payment_method"
|
|
3208
|
-
]
|
|
3209
|
-
},
|
|
3210
|
-
{
|
|
3211
|
-
"name": "line_items",
|
|
3212
|
-
"description": "Line items object describing the credit note breakdown.",
|
|
3213
|
-
"type": "object",
|
|
3214
|
-
"required": true,
|
|
3215
|
-
"position": "body"
|
|
3216
|
-
},
|
|
3217
|
-
{
|
|
3218
|
-
"name": "invoice_id",
|
|
3219
|
-
"description": "Optional invoice UUID to associate the credit note with.",
|
|
3220
|
-
"type": "string",
|
|
3221
|
-
"required": false,
|
|
3222
|
-
"position": "body"
|
|
3223
|
-
}
|
|
3224
|
-
],
|
|
3225
|
-
"requestTemplate": {
|
|
3226
|
-
"url": "/credit_notes",
|
|
3227
|
-
"method": "POST",
|
|
3228
|
-
"headers": {
|
|
3229
|
-
"Content-Type": "application/json"
|
|
3230
|
-
}
|
|
3231
|
-
},
|
|
3232
|
-
"responseTemplate": {
|
|
3233
|
-
"prependBody": "## Credit Note Created\n\n"
|
|
3234
|
-
}
|
|
3235
|
-
},
|
|
3236
3111
|
{
|
|
3237
3112
|
"name": "getCreditNoteById",
|
|
3238
3113
|
"description": "Retrieve a credit note by its ID, including amount, status, customer, invoice association, and line items URL.",
|
|
@@ -3360,7 +3235,7 @@
|
|
|
3360
3235
|
},
|
|
3361
3236
|
{
|
|
3362
3237
|
"name": "updatePayment",
|
|
3363
|
-
"description": "Update a payment's invoice allocations
|
|
3238
|
+
"description": "Update a payment's invoice allocations. The API requires a non-empty request body with payment_parts.",
|
|
3364
3239
|
"args": [
|
|
3365
3240
|
{
|
|
3366
3241
|
"name": "paymentId",
|
|
@@ -3371,9 +3246,9 @@
|
|
|
3371
3246
|
},
|
|
3372
3247
|
{
|
|
3373
3248
|
"name": "payment_parts",
|
|
3374
|
-
"description": "Updated array of invoice allocations. Each element: {invoice_id: 'UUID', amount: 10000}.",
|
|
3249
|
+
"description": "Updated array of invoice allocations. Each element: {invoice_id: 'UUID', amount: 10000}. This field is required by the API.",
|
|
3375
3250
|
"type": "array",
|
|
3376
|
-
"required":
|
|
3251
|
+
"required": true,
|
|
3377
3252
|
"position": "body"
|
|
3378
3253
|
}
|
|
3379
3254
|
],
|
|
@@ -3423,7 +3298,7 @@
|
|
|
3423
3298
|
"position": "path"
|
|
3424
3299
|
},
|
|
3425
3300
|
{
|
|
3426
|
-
"name": "
|
|
3301
|
+
"name": "refund_amount",
|
|
3427
3302
|
"description": "Amount to refund.",
|
|
3428
3303
|
"type": "number",
|
|
3429
3304
|
"required": true,
|
|
@@ -3497,15 +3372,29 @@
|
|
|
3497
3372
|
"position": "body"
|
|
3498
3373
|
},
|
|
3499
3374
|
{
|
|
3500
|
-
"name": "
|
|
3501
|
-
"description": "Updated payment method.",
|
|
3375
|
+
"name": "payment_method_details",
|
|
3376
|
+
"description": "Updated payment method details object.",
|
|
3377
|
+
"type": "object",
|
|
3378
|
+
"required": false,
|
|
3379
|
+
"position": "body"
|
|
3380
|
+
},
|
|
3381
|
+
{
|
|
3382
|
+
"name": "payment_parts",
|
|
3383
|
+
"description": "Updated invoice allocations. Array of {invoice_id, amount}.",
|
|
3384
|
+
"type": "array",
|
|
3385
|
+
"required": false,
|
|
3386
|
+
"position": "body"
|
|
3387
|
+
},
|
|
3388
|
+
{
|
|
3389
|
+
"name": "external_id",
|
|
3390
|
+
"description": "Updated external reference ID.",
|
|
3502
3391
|
"type": "string",
|
|
3503
3392
|
"required": false,
|
|
3504
3393
|
"position": "body"
|
|
3505
3394
|
},
|
|
3506
3395
|
{
|
|
3507
|
-
"name": "
|
|
3508
|
-
"description": "Updated
|
|
3396
|
+
"name": "timestamp",
|
|
3397
|
+
"description": "Updated payment timestamp in ISO 8601 format.",
|
|
3509
3398
|
"type": "string",
|
|
3510
3399
|
"required": false,
|
|
3511
3400
|
"position": "body"
|
|
@@ -3662,8 +3551,8 @@
|
|
|
3662
3551
|
"position": "query"
|
|
3663
3552
|
},
|
|
3664
3553
|
{
|
|
3665
|
-
"name": "
|
|
3666
|
-
"description": "
|
|
3554
|
+
"name": "name__ilike",
|
|
3555
|
+
"description": "Case-insensitive partial match for product name.",
|
|
3667
3556
|
"type": "string",
|
|
3668
3557
|
"required": false,
|
|
3669
3558
|
"position": "query"
|
|
@@ -3737,8 +3626,8 @@
|
|
|
3737
3626
|
"position": "query"
|
|
3738
3627
|
},
|
|
3739
3628
|
{
|
|
3740
|
-
"name": "
|
|
3741
|
-
"description": "
|
|
3629
|
+
"name": "name__ilike",
|
|
3630
|
+
"description": "Case-insensitive partial match for account name.",
|
|
3742
3631
|
"type": "string",
|
|
3743
3632
|
"required": false,
|
|
3744
3633
|
"position": "query"
|
|
@@ -3766,13 +3655,6 @@
|
|
|
3766
3655
|
"required": true,
|
|
3767
3656
|
"position": "body"
|
|
3768
3657
|
},
|
|
3769
|
-
{
|
|
3770
|
-
"name": "account_code",
|
|
3771
|
-
"description": "Unique account code/number.",
|
|
3772
|
-
"type": "string",
|
|
3773
|
-
"required": false,
|
|
3774
|
-
"position": "body"
|
|
3775
|
-
},
|
|
3776
3658
|
{
|
|
3777
3659
|
"name": "account_category",
|
|
3778
3660
|
"description": "Category of account. Valid values: 'Assets', 'Liabilities', 'Equity', 'Income', 'Expenses'.",
|
|
@@ -3788,9 +3670,9 @@
|
|
|
3788
3670
|
"position": "body"
|
|
3789
3671
|
},
|
|
3790
3672
|
{
|
|
3791
|
-
"name": "
|
|
3792
|
-
"description": "
|
|
3793
|
-
"type": "
|
|
3673
|
+
"name": "custom_data",
|
|
3674
|
+
"description": "Custom data object for the account.",
|
|
3675
|
+
"type": "object",
|
|
3794
3676
|
"required": false,
|
|
3795
3677
|
"position": "body"
|
|
3796
3678
|
}
|
|
@@ -3825,8 +3707,8 @@
|
|
|
3825
3707
|
"position": "query"
|
|
3826
3708
|
},
|
|
3827
3709
|
{
|
|
3828
|
-
"name": "
|
|
3829
|
-
"description": "Search query to filter journal entries.
|
|
3710
|
+
"name": "search_query",
|
|
3711
|
+
"description": "Search query to filter journal entries.",
|
|
3830
3712
|
"type": "string",
|
|
3831
3713
|
"required": false,
|
|
3832
3714
|
"position": "query"
|
|
@@ -3944,8 +3826,8 @@
|
|
|
3944
3826
|
"position": "query"
|
|
3945
3827
|
},
|
|
3946
3828
|
{
|
|
3947
|
-
"name": "
|
|
3948
|
-
"description": "Search query to filter journal lines.
|
|
3829
|
+
"name": "search_query",
|
|
3830
|
+
"description": "Search query to filter journal lines.",
|
|
3949
3831
|
"type": "string",
|
|
3950
3832
|
"required": false,
|
|
3951
3833
|
"position": "query"
|
|
@@ -3967,8 +3849,15 @@
|
|
|
3967
3849
|
"description": "Retrieve the balance sheet report showing assets, liabilities, and equity.",
|
|
3968
3850
|
"args": [
|
|
3969
3851
|
{
|
|
3970
|
-
"name": "
|
|
3971
|
-
"description": "
|
|
3852
|
+
"name": "start_date",
|
|
3853
|
+
"description": "Start date for the balance sheet period (YYYY-MM-DD).",
|
|
3854
|
+
"type": "string",
|
|
3855
|
+
"required": false,
|
|
3856
|
+
"position": "query"
|
|
3857
|
+
},
|
|
3858
|
+
{
|
|
3859
|
+
"name": "end_date",
|
|
3860
|
+
"description": "End date for the balance sheet period (YYYY-MM-DD). Defaults to today.",
|
|
3972
3861
|
"type": "string",
|
|
3973
3862
|
"required": false,
|
|
3974
3863
|
"position": "query"
|
|
@@ -4027,7 +3916,7 @@
|
|
|
4027
3916
|
"position": "path"
|
|
4028
3917
|
},
|
|
4029
3918
|
{
|
|
4030
|
-
"name": "
|
|
3919
|
+
"name": "as_of",
|
|
4031
3920
|
"description": "Date for the balance snapshot (YYYY-MM-DD).",
|
|
4032
3921
|
"type": "string",
|
|
4033
3922
|
"required": false,
|
|
@@ -4072,7 +3961,7 @@
|
|
|
4072
3961
|
},
|
|
4073
3962
|
{
|
|
4074
3963
|
"name": "type",
|
|
4075
|
-
"description": "Product type.
|
|
3964
|
+
"description": "Product type. Valid values: 'product' (standard product) or 'group' (product group).",
|
|
4076
3965
|
"type": "string",
|
|
4077
3966
|
"required": true,
|
|
4078
3967
|
"position": "body"
|
|
@@ -4225,7 +4114,7 @@
|
|
|
4225
4114
|
},
|
|
4226
4115
|
{
|
|
4227
4116
|
"name": "pricing_data",
|
|
4228
|
-
"description": "Pricing data object (required). Must include 'pricing_type' discriminator. Supported types: flat_fee: {pricing_type:'flat_fee', unit_amount:10000}
|
|
4117
|
+
"description": "Pricing data object (required). Must include 'pricing_type' discriminator. Supported types: flat_fee: {pricing_type:'flat_fee', unit_amount:10000}. per_unit: {pricing_type:'per_unit', unit_amount:500}. tiered: {pricing_type:'tiered', unit_amount:[1000,500], up_to:[100,null]}. volume: {pricing_type:'volume', unit_amount:[1000,500], up_to:[100,null]}. percent: {pricing_type:'percent', percentage:5.0}. package: {pricing_type:'package', package_size:10, unit_amount:5000}. step: {pricing_type:'step', unit_amount:[...], up_to:[...]}. matrix: {pricing_type:'matrix', dimensions:[...], values:[...]}.",
|
|
4229
4118
|
"type": "object",
|
|
4230
4119
|
"required": true,
|
|
4231
4120
|
"position": "body"
|
|
@@ -4282,8 +4171,15 @@
|
|
|
4282
4171
|
"position": "query"
|
|
4283
4172
|
},
|
|
4284
4173
|
{
|
|
4285
|
-
"name": "
|
|
4286
|
-
"description": "
|
|
4174
|
+
"name": "name__ilike",
|
|
4175
|
+
"description": "Case-insensitive partial match for plan name.",
|
|
4176
|
+
"type": "string",
|
|
4177
|
+
"required": false,
|
|
4178
|
+
"position": "query"
|
|
4179
|
+
},
|
|
4180
|
+
{
|
|
4181
|
+
"name": "status",
|
|
4182
|
+
"description": "Filter by plan status. Valid values: draft, active, archived.",
|
|
4287
4183
|
"type": "string",
|
|
4288
4184
|
"required": false,
|
|
4289
4185
|
"position": "query"
|
|
@@ -4445,9 +4341,9 @@
|
|
|
4445
4341
|
},
|
|
4446
4342
|
{
|
|
4447
4343
|
"name": "end_date",
|
|
4448
|
-
"description": "End date for the estimate (YYYY-MM-DD).",
|
|
4344
|
+
"description": "End date for the estimate (YYYY-MM-DD). Optional — calculated from plan duration if omitted.",
|
|
4449
4345
|
"type": "string",
|
|
4450
|
-
"required":
|
|
4346
|
+
"required": false,
|
|
4451
4347
|
"position": "body"
|
|
4452
4348
|
}
|
|
4453
4349
|
],
|
|
@@ -4467,8 +4363,8 @@
|
|
|
4467
4363
|
"description": "Retrieve a list of custom attribute definitions configured for the organization.",
|
|
4468
4364
|
"args": [
|
|
4469
4365
|
{
|
|
4470
|
-
"name": "
|
|
4471
|
-
"description": "Filter by
|
|
4366
|
+
"name": "module",
|
|
4367
|
+
"description": "Filter by module. Valid values: 'customers', 'contracts', 'invoices', 'payments', 'products', 'plans'.",
|
|
4472
4368
|
"type": "string",
|
|
4473
4369
|
"required": false,
|
|
4474
4370
|
"position": "query"
|
|
@@ -4512,7 +4408,7 @@
|
|
|
4512
4408
|
},
|
|
4513
4409
|
{
|
|
4514
4410
|
"name": "data_type",
|
|
4515
|
-
"description": "Data type of the attribute
|
|
4411
|
+
"description": "Data type of the attribute. Valid values: 'STRING', 'INTEGER', 'FLOAT', 'BOOLEAN', 'LIST_STRING', 'ENUM', 'JSON', 'DATE'.",
|
|
4516
4412
|
"type": "string",
|
|
4517
4413
|
"required": true,
|
|
4518
4414
|
"position": "body"
|
|
@@ -4584,23 +4480,9 @@
|
|
|
4584
4480
|
"position": "body"
|
|
4585
4481
|
},
|
|
4586
4482
|
{
|
|
4587
|
-
"name": "
|
|
4588
|
-
"description": "
|
|
4589
|
-
"type": "
|
|
4590
|
-
"required": false,
|
|
4591
|
-
"position": "body"
|
|
4592
|
-
},
|
|
4593
|
-
{
|
|
4594
|
-
"name": "description",
|
|
4595
|
-
"description": "Description of the tax category.",
|
|
4596
|
-
"type": "string",
|
|
4597
|
-
"required": false,
|
|
4598
|
-
"position": "body"
|
|
4599
|
-
},
|
|
4600
|
-
{
|
|
4601
|
-
"name": "rate",
|
|
4602
|
-
"description": "Tax rate as a decimal (e.g., 0.1 for 10%).",
|
|
4603
|
-
"type": "number",
|
|
4483
|
+
"name": "external_codes",
|
|
4484
|
+
"description": "Array of external tax code mappings (e.g., [{ \"provider\": \"avalara\", \"code\": \"P0000000\" }]).",
|
|
4485
|
+
"type": "array",
|
|
4604
4486
|
"required": false,
|
|
4605
4487
|
"position": "body"
|
|
4606
4488
|
}
|
|
@@ -4878,9 +4760,9 @@
|
|
|
4878
4760
|
"position": "body"
|
|
4879
4761
|
},
|
|
4880
4762
|
{
|
|
4881
|
-
"name": "
|
|
4882
|
-
"description": "
|
|
4883
|
-
"type": "
|
|
4763
|
+
"name": "tax_config",
|
|
4764
|
+
"description": "Tax configuration object (e.g., { \"tax_id\": \"...\", \"tax_provider\": \"...\" }).",
|
|
4765
|
+
"type": "object",
|
|
4884
4766
|
"required": false,
|
|
4885
4767
|
"position": "body"
|
|
4886
4768
|
},
|
|
@@ -5161,14 +5043,14 @@
|
|
|
5161
5043
|
"position": "body"
|
|
5162
5044
|
},
|
|
5163
5045
|
{
|
|
5164
|
-
"name": "
|
|
5165
|
-
"description": "Payment
|
|
5046
|
+
"name": "connector",
|
|
5047
|
+
"description": "Payment connector name (e.g., 'stripe').",
|
|
5166
5048
|
"type": "string",
|
|
5167
5049
|
"required": false,
|
|
5168
5050
|
"position": "body"
|
|
5169
5051
|
},
|
|
5170
5052
|
{
|
|
5171
|
-
"name": "
|
|
5053
|
+
"name": "set_as_default",
|
|
5172
5054
|
"description": "Whether to set as the default payment method.",
|
|
5173
5055
|
"type": "boolean",
|
|
5174
5056
|
"required": false,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
class ResponseProcessor {
|
|
3
3
|
constructor() {
|
|
4
4
|
// Minimal configuration
|
|
5
|
-
this.maxResponseLength =
|
|
5
|
+
this.maxResponseLength = 2000000;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
processResponse(responseData, toolName) {
|
|
@@ -25,4 +25,4 @@ class ResponseProcessor {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
module.exports = ResponseProcessor;
|
|
28
|
+
module.exports = ResponseProcessor;
|
package/src/server.js
CHANGED
|
@@ -196,6 +196,203 @@ function normalizeRawMetricDataschema(schema) {
|
|
|
196
196
|
return normalized;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
function extractListPayload(data) {
|
|
200
|
+
if (!data) return [];
|
|
201
|
+
if (Array.isArray(data)) return data;
|
|
202
|
+
if (Array.isArray(data.results)) return data.results;
|
|
203
|
+
if (data.api_response !== undefined) return extractListPayload(data.api_response);
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function normalizeAccountCategory(category) {
|
|
208
|
+
if (!category || typeof category !== 'string') return 'Uncategorized';
|
|
209
|
+
const normalized = category.trim();
|
|
210
|
+
if (!normalized) return 'Uncategorized';
|
|
211
|
+
return normalized;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function getCategoryOrder(reportType, category) {
|
|
215
|
+
const balanceSheetOrder = {
|
|
216
|
+
Assets: 1,
|
|
217
|
+
Liabilities: 2,
|
|
218
|
+
Equity: 3
|
|
219
|
+
};
|
|
220
|
+
const incomeStatementOrder = {
|
|
221
|
+
Income: 1,
|
|
222
|
+
Revenue: 1,
|
|
223
|
+
'Cost of Goods Sold': 2,
|
|
224
|
+
Expense: 3,
|
|
225
|
+
Expenses: 3,
|
|
226
|
+
'Other Income': 4,
|
|
227
|
+
'Other Expense': 5,
|
|
228
|
+
'Other Expenses': 5
|
|
229
|
+
};
|
|
230
|
+
const map = reportType === 'getBalanceSheet' ? balanceSheetOrder : incomeStatementOrder;
|
|
231
|
+
return map[category] || 999;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function buildPeriodKey(row) {
|
|
235
|
+
const start = row?.interval_start || 'unknown_start';
|
|
236
|
+
const end = row?.interval_end || 'unknown_end';
|
|
237
|
+
return `${start}__${end}`;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function summarizePeriods(periodMap) {
|
|
241
|
+
return Object.values(periodMap)
|
|
242
|
+
.sort((a, b) => String(a.interval_start).localeCompare(String(b.interval_start)));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function buildAccountingStatementView(reportType, rows, accountLookup) {
|
|
246
|
+
const periodMap = new Map();
|
|
247
|
+
const sectionsMap = new Map();
|
|
248
|
+
|
|
249
|
+
rows.forEach(row => {
|
|
250
|
+
const category = normalizeAccountCategory(row.account_category);
|
|
251
|
+
const periodKey = buildPeriodKey(row);
|
|
252
|
+
const periodEntry = periodMap.get(periodKey) || {
|
|
253
|
+
key: periodKey,
|
|
254
|
+
interval_start: row.interval_start || null,
|
|
255
|
+
interval_end: row.interval_end || null
|
|
256
|
+
};
|
|
257
|
+
periodMap.set(periodKey, periodEntry);
|
|
258
|
+
|
|
259
|
+
if (!sectionsMap.has(category)) {
|
|
260
|
+
sectionsMap.set(category, {
|
|
261
|
+
category,
|
|
262
|
+
accounts: new Map(),
|
|
263
|
+
totals_by_period: {},
|
|
264
|
+
total_balance: 0,
|
|
265
|
+
total_debits: 0,
|
|
266
|
+
total_credits: 0
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const section = sectionsMap.get(category);
|
|
271
|
+
const accountId = row.account_id || 'unknown_account';
|
|
272
|
+
const accountMeta = accountLookup.get(accountId) || {};
|
|
273
|
+
if (!section.accounts.has(accountId)) {
|
|
274
|
+
section.accounts.set(accountId, {
|
|
275
|
+
account_id: accountId,
|
|
276
|
+
account_name: row.account_name || accountMeta.name || accountId,
|
|
277
|
+
account_description: row.account_description || accountMeta.description || null,
|
|
278
|
+
account_category: category,
|
|
279
|
+
parent_path: row.account_parent_path || accountMeta.parent_path || null,
|
|
280
|
+
balance_normality: row.balance_normality || accountMeta.balance_normality || null,
|
|
281
|
+
periods: {},
|
|
282
|
+
total_balance: 0,
|
|
283
|
+
total_debits: 0,
|
|
284
|
+
total_credits: 0
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const account = section.accounts.get(accountId);
|
|
289
|
+
account.periods[periodKey] = {
|
|
290
|
+
interval_start: row.interval_start || null,
|
|
291
|
+
interval_end: row.interval_end || null,
|
|
292
|
+
balance: row.balance ?? 0,
|
|
293
|
+
debits: row.debits ?? 0,
|
|
294
|
+
credits: row.credits ?? 0
|
|
295
|
+
};
|
|
296
|
+
account.total_balance += Number(row.balance || 0);
|
|
297
|
+
account.total_debits += Number(row.debits || 0);
|
|
298
|
+
account.total_credits += Number(row.credits || 0);
|
|
299
|
+
|
|
300
|
+
const sectionPeriod = section.totals_by_period[periodKey] || {
|
|
301
|
+
interval_start: row.interval_start || null,
|
|
302
|
+
interval_end: row.interval_end || null,
|
|
303
|
+
balance: 0,
|
|
304
|
+
debits: 0,
|
|
305
|
+
credits: 0
|
|
306
|
+
};
|
|
307
|
+
sectionPeriod.balance += Number(row.balance || 0);
|
|
308
|
+
sectionPeriod.debits += Number(row.debits || 0);
|
|
309
|
+
sectionPeriod.credits += Number(row.credits || 0);
|
|
310
|
+
section.totals_by_period[periodKey] = sectionPeriod;
|
|
311
|
+
section.total_balance += Number(row.balance || 0);
|
|
312
|
+
section.total_debits += Number(row.debits || 0);
|
|
313
|
+
section.total_credits += Number(row.credits || 0);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
const sections = Array.from(sectionsMap.values())
|
|
317
|
+
.sort((a, b) => {
|
|
318
|
+
const orderDiff = getCategoryOrder(reportType, a.category) - getCategoryOrder(reportType, b.category);
|
|
319
|
+
return orderDiff !== 0 ? orderDiff : a.category.localeCompare(b.category);
|
|
320
|
+
})
|
|
321
|
+
.map(section => ({
|
|
322
|
+
category: section.category,
|
|
323
|
+
accounts: Array.from(section.accounts.values())
|
|
324
|
+
.sort((a, b) => a.account_name.localeCompare(b.account_name))
|
|
325
|
+
.map(account => ({
|
|
326
|
+
...account,
|
|
327
|
+
periods: summarizePeriods(account.periods)
|
|
328
|
+
})),
|
|
329
|
+
totals_by_period: summarizePeriods(section.totals_by_period),
|
|
330
|
+
total_balance: section.total_balance,
|
|
331
|
+
total_debits: section.total_debits,
|
|
332
|
+
total_credits: section.total_credits
|
|
333
|
+
}));
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
report_type: reportType === 'getBalanceSheet' ? 'balance_sheet' : 'income_statement',
|
|
337
|
+
periods: Array.from(periodMap.values()).sort((a, b) => String(a.interval_start).localeCompare(String(b.interval_start))),
|
|
338
|
+
sections
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
async function fetchJson(url, headers) {
|
|
343
|
+
const response = await fetch(url, { method: 'GET', headers });
|
|
344
|
+
const text = await response.text();
|
|
345
|
+
if (!response.ok) {
|
|
346
|
+
throw new Error(`Supplemental fetch failed: ${response.status} ${response.statusText}\nResponse: ${text}`);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
try {
|
|
350
|
+
return JSON.parse(text);
|
|
351
|
+
} catch (_error) {
|
|
352
|
+
throw new Error(`Supplemental fetch returned non-JSON response: ${text}`);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
async function enrichAccountingReportResult(toolName, result, headers, baseUrl) {
|
|
357
|
+
if (!result || !Array.isArray(result.results)) {
|
|
358
|
+
return result;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
try {
|
|
362
|
+
const chartUrl = `${baseUrl}/accounting_new/chart_of_accounts`;
|
|
363
|
+
const chartData = await fetchJson(chartUrl, headers);
|
|
364
|
+
const chartAccounts = extractListPayload(chartData);
|
|
365
|
+
const accountLookup = new Map(
|
|
366
|
+
chartAccounts
|
|
367
|
+
.filter(account => account && account.id)
|
|
368
|
+
.map(account => [account.id, account])
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
const enrichedRows = result.results.map(row => {
|
|
372
|
+
const account = accountLookup.get(row.account_id) || {};
|
|
373
|
+
return {
|
|
374
|
+
...row,
|
|
375
|
+
account_name: account.name || row.account_id || null,
|
|
376
|
+
account_description: account.description || null,
|
|
377
|
+
account_category: normalizeAccountCategory(account.account_category),
|
|
378
|
+
account_parent_path: account.parent_path || null,
|
|
379
|
+
balance_normality: account.balance_normality || null
|
|
380
|
+
};
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
return {
|
|
384
|
+
...result,
|
|
385
|
+
results: enrichedRows,
|
|
386
|
+
statement_view: buildAccountingStatementView(toolName, enrichedRows, accountLookup)
|
|
387
|
+
};
|
|
388
|
+
} catch (error) {
|
|
389
|
+
logger.warn(`[${toolName}] Failed to enrich accounting report output; returning raw report`, {
|
|
390
|
+
error: error.message
|
|
391
|
+
});
|
|
392
|
+
return result;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
199
396
|
// Helper function to convert OpenAPI args to Zod schema
|
|
200
397
|
function convertArgsToZodSchema(args) {
|
|
201
398
|
const schemaObj = {};
|
|
@@ -587,7 +784,9 @@ async function executeAPICall(tool, args) {
|
|
|
587
784
|
|
|
588
785
|
if (!response.ok) {
|
|
589
786
|
logger.error(`[${tool.name}] API Error Response:`, responseText);
|
|
590
|
-
|
|
787
|
+
let errorMessage = `API request failed: ${response.status} ${response.statusText}\nResponse: ${responseText}`;
|
|
788
|
+
|
|
789
|
+
throw new Error(errorMessage);
|
|
591
790
|
}
|
|
592
791
|
|
|
593
792
|
let result;
|
|
@@ -597,6 +796,11 @@ async function executeAPICall(tool, args) {
|
|
|
597
796
|
logger.debug(`[${tool.name}] Failed to parse JSON response, returning as text`);
|
|
598
797
|
result = responseText;
|
|
599
798
|
}
|
|
799
|
+
|
|
800
|
+
if (tool.name === 'getBalanceSheet' || tool.name === 'getIncomeStatement') {
|
|
801
|
+
const baseUrl = process.env.ZENSKAR_API_BASE_URL || 'https://api.zenskar.com';
|
|
802
|
+
result = await enrichAccountingReportResult(tool.name, result, headers, baseUrl);
|
|
803
|
+
}
|
|
600
804
|
|
|
601
805
|
// Apply response template if available
|
|
602
806
|
if (tool.responseTemplate?.prependBody) {
|
|
@@ -815,7 +1019,7 @@ if (mcpConfig.tools && mcpConfig.tools.length > 0) {
|
|
|
815
1019
|
|
|
816
1020
|
// Use adjusted args with enforced limits
|
|
817
1021
|
const adjustedArgs = limitsValidation.adjustedArgs;
|
|
818
|
-
|
|
1022
|
+
|
|
819
1023
|
// Track limit adjustments
|
|
820
1024
|
if (args.limit && adjustedArgs.limit && args.limit !== adjustedArgs.limit) {
|
|
821
1025
|
limitRequested = args.limit;
|