@avallon-labs/mcp 72.4.0 → 72.6.0-staging.1547

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 CHANGED
@@ -56,5 +56,5 @@ function describeErrors(body) {
56
56
 
57
57
  // src/index.ts
58
58
  setupFetch();
59
- await import("./server-JLVG5YXW.js");
59
+ await import("./server-YZTZCXBV.js");
60
60
  //# sourceMappingURL=index.js.map
@@ -3839,6 +3839,141 @@ var deleteOrgUnit = async (orgUnitId, options) => {
3839
3839
  const data = body ? JSON.parse(body) : void 0;
3840
3840
  return { data, status: res.status, headers: res.headers };
3841
3841
  };
3842
+ var getCreateLedgerUrl = () => {
3843
+ return `/v1/ledgers`;
3844
+ };
3845
+ var createLedger = async (createLedgerBody, options) => {
3846
+ const getHeaders = (h) => {
3847
+ if (!h) return {};
3848
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
3849
+ if (Array.isArray(h)) return Object.fromEntries(h);
3850
+ return h;
3851
+ };
3852
+ const res = await fetch(
3853
+ getCreateLedgerUrl(),
3854
+ {
3855
+ ...options,
3856
+ method: "POST",
3857
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
3858
+ body: JSON.stringify(createLedgerBody)
3859
+ }
3860
+ );
3861
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3862
+ const data = body ? JSON.parse(body) : {};
3863
+ return { data, status: res.status, headers: res.headers };
3864
+ };
3865
+ var getListLedgersUrl = (params) => {
3866
+ const normalizedParams = new URLSearchParams();
3867
+ Object.entries(params || {}).forEach(([key, value]) => {
3868
+ if (value !== void 0) {
3869
+ normalizedParams.append(key, value === null ? "null" : String(value));
3870
+ }
3871
+ });
3872
+ const stringifiedParams = normalizedParams.toString();
3873
+ return stringifiedParams.length > 0 ? `/v1/ledgers?${stringifiedParams}` : `/v1/ledgers`;
3874
+ };
3875
+ var listLedgers = async (params, options) => {
3876
+ const res = await fetch(
3877
+ getListLedgersUrl(params),
3878
+ {
3879
+ ...options,
3880
+ method: "GET"
3881
+ }
3882
+ );
3883
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3884
+ const data = body ? JSON.parse(body) : {};
3885
+ return { data, status: res.status, headers: res.headers };
3886
+ };
3887
+ var getCreateLedgerAccountUrl = (ledgerId) => {
3888
+ return `/v1/ledgers/${ledgerId}/accounts`;
3889
+ };
3890
+ var createLedgerAccount = async (ledgerId, createLedgerAccountBody, options) => {
3891
+ const getHeaders = (h) => {
3892
+ if (!h) return {};
3893
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
3894
+ if (Array.isArray(h)) return Object.fromEntries(h);
3895
+ return h;
3896
+ };
3897
+ const res = await fetch(
3898
+ getCreateLedgerAccountUrl(ledgerId),
3899
+ {
3900
+ ...options,
3901
+ method: "POST",
3902
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
3903
+ body: JSON.stringify(createLedgerAccountBody)
3904
+ }
3905
+ );
3906
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3907
+ const data = body ? JSON.parse(body) : {};
3908
+ return { data, status: res.status, headers: res.headers };
3909
+ };
3910
+ var getListLedgerAccountsUrl = (ledgerId, params) => {
3911
+ const normalizedParams = new URLSearchParams();
3912
+ Object.entries(params || {}).forEach(([key, value]) => {
3913
+ if (value !== void 0) {
3914
+ normalizedParams.append(key, value === null ? "null" : String(value));
3915
+ }
3916
+ });
3917
+ const stringifiedParams = normalizedParams.toString();
3918
+ return stringifiedParams.length > 0 ? `/v1/ledgers/${ledgerId}/accounts?${stringifiedParams}` : `/v1/ledgers/${ledgerId}/accounts`;
3919
+ };
3920
+ var listLedgerAccounts = async (ledgerId, params, options) => {
3921
+ const res = await fetch(
3922
+ getListLedgerAccountsUrl(ledgerId, params),
3923
+ {
3924
+ ...options,
3925
+ method: "GET"
3926
+ }
3927
+ );
3928
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3929
+ const data = body ? JSON.parse(body) : {};
3930
+ return { data, status: res.status, headers: res.headers };
3931
+ };
3932
+ var getCreateLedgerBookingUrl = (ledgerId) => {
3933
+ return `/v1/ledgers/${ledgerId}/bookings`;
3934
+ };
3935
+ var createLedgerBooking = async (ledgerId, createLedgerBookingBody, options) => {
3936
+ const getHeaders = (h) => {
3937
+ if (!h) return {};
3938
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
3939
+ if (Array.isArray(h)) return Object.fromEntries(h);
3940
+ return h;
3941
+ };
3942
+ const res = await fetch(
3943
+ getCreateLedgerBookingUrl(ledgerId),
3944
+ {
3945
+ ...options,
3946
+ method: "POST",
3947
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
3948
+ body: JSON.stringify(createLedgerBookingBody)
3949
+ }
3950
+ );
3951
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3952
+ const data = body ? JSON.parse(body) : {};
3953
+ return { data, status: res.status, headers: res.headers };
3954
+ };
3955
+ var getListLedgerBookingsUrl = (ledgerId, params) => {
3956
+ const normalizedParams = new URLSearchParams();
3957
+ Object.entries(params || {}).forEach(([key, value]) => {
3958
+ if (value !== void 0) {
3959
+ normalizedParams.append(key, value === null ? "null" : String(value));
3960
+ }
3961
+ });
3962
+ const stringifiedParams = normalizedParams.toString();
3963
+ return stringifiedParams.length > 0 ? `/v1/ledgers/${ledgerId}/bookings?${stringifiedParams}` : `/v1/ledgers/${ledgerId}/bookings`;
3964
+ };
3965
+ var listLedgerBookings = async (ledgerId, params, options) => {
3966
+ const res = await fetch(
3967
+ getListLedgerBookingsUrl(ledgerId, params),
3968
+ {
3969
+ ...options,
3970
+ method: "GET"
3971
+ }
3972
+ );
3973
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3974
+ const data = body ? JSON.parse(body) : {};
3975
+ return { data, status: res.status, headers: res.headers };
3976
+ };
3842
3977
  var getListDispatchesUrl = (params) => {
3843
3978
  const normalizedParams = new URLSearchParams();
3844
3979
  Object.entries(params || {}).forEach(([key, value]) => {
@@ -9158,6 +9293,144 @@ var deleteOrgUnitHandler = async (args, options) => {
9158
9293
  structuredContent: res.data
9159
9294
  };
9160
9295
  };
9296
+ var createLedgerHandler = async (args, options) => {
9297
+ const res = await createLedger(args.bodyParams, options);
9298
+ if (res.status >= 400) {
9299
+ return {
9300
+ content: [
9301
+ {
9302
+ type: "text",
9303
+ text: JSON.stringify(res.data ?? null)
9304
+ }
9305
+ ],
9306
+ isError: true
9307
+ };
9308
+ }
9309
+ return {
9310
+ content: [
9311
+ {
9312
+ type: "text",
9313
+ text: JSON.stringify(res.data ?? null)
9314
+ }
9315
+ ],
9316
+ structuredContent: res.data
9317
+ };
9318
+ };
9319
+ var listLedgersHandler = async (args, options) => {
9320
+ const res = await listLedgers(args.queryParams, options);
9321
+ if (res.status >= 400) {
9322
+ return {
9323
+ content: [
9324
+ {
9325
+ type: "text",
9326
+ text: JSON.stringify(res.data ?? null)
9327
+ }
9328
+ ],
9329
+ isError: true
9330
+ };
9331
+ }
9332
+ return {
9333
+ content: [
9334
+ {
9335
+ type: "text",
9336
+ text: JSON.stringify(res.data ?? null)
9337
+ }
9338
+ ],
9339
+ structuredContent: res.data
9340
+ };
9341
+ };
9342
+ var createLedgerAccountHandler = async (args, options) => {
9343
+ const res = await createLedgerAccount(args.pathParams.ledgerId, args.bodyParams, options);
9344
+ if (res.status >= 400) {
9345
+ return {
9346
+ content: [
9347
+ {
9348
+ type: "text",
9349
+ text: JSON.stringify(res.data ?? null)
9350
+ }
9351
+ ],
9352
+ isError: true
9353
+ };
9354
+ }
9355
+ return {
9356
+ content: [
9357
+ {
9358
+ type: "text",
9359
+ text: JSON.stringify(res.data ?? null)
9360
+ }
9361
+ ],
9362
+ structuredContent: res.data
9363
+ };
9364
+ };
9365
+ var listLedgerAccountsHandler = async (args, options) => {
9366
+ const res = await listLedgerAccounts(args.pathParams.ledgerId, args.queryParams, options);
9367
+ if (res.status >= 400) {
9368
+ return {
9369
+ content: [
9370
+ {
9371
+ type: "text",
9372
+ text: JSON.stringify(res.data ?? null)
9373
+ }
9374
+ ],
9375
+ isError: true
9376
+ };
9377
+ }
9378
+ return {
9379
+ content: [
9380
+ {
9381
+ type: "text",
9382
+ text: JSON.stringify(res.data ?? null)
9383
+ }
9384
+ ],
9385
+ structuredContent: res.data
9386
+ };
9387
+ };
9388
+ var createLedgerBookingHandler = async (args, options) => {
9389
+ const res = await createLedgerBooking(args.pathParams.ledgerId, args.bodyParams, options);
9390
+ if (res.status >= 400) {
9391
+ return {
9392
+ content: [
9393
+ {
9394
+ type: "text",
9395
+ text: JSON.stringify(res.data ?? null)
9396
+ }
9397
+ ],
9398
+ isError: true
9399
+ };
9400
+ }
9401
+ return {
9402
+ content: [
9403
+ {
9404
+ type: "text",
9405
+ text: JSON.stringify(res.data ?? null)
9406
+ }
9407
+ ],
9408
+ structuredContent: res.data
9409
+ };
9410
+ };
9411
+ var listLedgerBookingsHandler = async (args, options) => {
9412
+ const res = await listLedgerBookings(args.pathParams.ledgerId, args.queryParams, options);
9413
+ if (res.status >= 400) {
9414
+ return {
9415
+ content: [
9416
+ {
9417
+ type: "text",
9418
+ text: JSON.stringify(res.data ?? null)
9419
+ }
9420
+ ],
9421
+ isError: true
9422
+ };
9423
+ }
9424
+ return {
9425
+ content: [
9426
+ {
9427
+ type: "text",
9428
+ text: JSON.stringify(res.data ?? null)
9429
+ }
9430
+ ],
9431
+ structuredContent: res.data
9432
+ };
9433
+ };
9161
9434
  var listDispatchesHandler = async (args, options) => {
9162
9435
  const res = await listDispatches(args.queryParams, options);
9163
9436
  if (res.status >= 400) {
@@ -14811,6 +15084,8 @@ var GetFormSubmissionResponse = zod.object({
14811
15084
  "message": zod.string()
14812
15085
  });
14813
15086
  var createIntakeBodyDryRunDefault = false;
15087
+ var createIntakeBodyRoutesItemPropertiesItemNameRegExp = new RegExp("^[a-z][a-z0-9_]*$");
15088
+ var createIntakeBodyRoutesItemPropertiesDefault = [];
14814
15089
  var CreateIntakeBody = zod.object({
14815
15090
  "name": zod.string().min(1),
14816
15091
  "dry_run": zod.boolean().default(createIntakeBodyDryRunDefault),
@@ -14818,7 +15093,12 @@ var CreateIntakeBody = zod.object({
14818
15093
  "name": zod.string().min(1),
14819
15094
  "description": zod.string().min(1).describe("What the routing worker reads to pick this route."),
14820
15095
  "processor_type": zod.enum(["extractor", "worker"]),
14821
- "processor_id": zod.string().uuid()
15096
+ "processor_id": zod.string().uuid(),
15097
+ "properties": zod.array(zod.object({
15098
+ "name": zod.string().regex(createIntakeBodyRoutesItemPropertiesItemNameRegExp),
15099
+ "description": zod.string().min(1).describe("What the routing worker reads to find the value."),
15100
+ "required": zod.boolean().describe("Whether a bundle needs a value for it before it is sent to the route.")
15101
+ })).default(createIntakeBodyRoutesItemPropertiesDefault)
14822
15102
  })).min(1)
14823
15103
  });
14824
15104
  var CreateIntakeResponse = zod.object({
@@ -14837,7 +15117,12 @@ var CreateIntakeResponse = zod.object({
14837
15117
  "name": zod.string(),
14838
15118
  "description": zod.string(),
14839
15119
  "processor_type": zod.enum(["extractor", "worker"]),
14840
- "processor_id": zod.string()
15120
+ "processor_id": zod.string(),
15121
+ "properties": zod.array(zod.object({
15122
+ "name": zod.string(),
15123
+ "description": zod.string(),
15124
+ "required": zod.boolean()
15125
+ }))
14841
15126
  })),
14842
15127
  "created_at": zod.string().datetime({ "offset": true }),
14843
15128
  "updated_at": zod.string().datetime({ "offset": true })
@@ -14872,7 +15157,12 @@ var ListIntakesResponse = zod.object({
14872
15157
  "name": zod.string(),
14873
15158
  "description": zod.string(),
14874
15159
  "processor_type": zod.enum(["extractor", "worker"]),
14875
- "processor_id": zod.string()
15160
+ "processor_id": zod.string(),
15161
+ "properties": zod.array(zod.object({
15162
+ "name": zod.string(),
15163
+ "description": zod.string(),
15164
+ "required": zod.boolean()
15165
+ }))
14876
15166
  })),
14877
15167
  "created_at": zod.string().datetime({ "offset": true }),
14878
15168
  "updated_at": zod.string().datetime({ "offset": true })
@@ -14901,7 +15191,12 @@ var GetIntakeResponse = zod.object({
14901
15191
  "name": zod.string(),
14902
15192
  "description": zod.string(),
14903
15193
  "processor_type": zod.enum(["extractor", "worker"]),
14904
- "processor_id": zod.string()
15194
+ "processor_id": zod.string(),
15195
+ "properties": zod.array(zod.object({
15196
+ "name": zod.string(),
15197
+ "description": zod.string(),
15198
+ "required": zod.boolean()
15199
+ }))
14905
15200
  })),
14906
15201
  "created_at": zod.string().datetime({ "offset": true }),
14907
15202
  "updated_at": zod.string().datetime({ "offset": true }),
@@ -14931,7 +15226,12 @@ var UpdateIntakeResponse = zod.object({
14931
15226
  "name": zod.string(),
14932
15227
  "description": zod.string(),
14933
15228
  "processor_type": zod.enum(["extractor", "worker"]),
14934
- "processor_id": zod.string()
15229
+ "processor_id": zod.string(),
15230
+ "properties": zod.array(zod.object({
15231
+ "name": zod.string(),
15232
+ "description": zod.string(),
15233
+ "required": zod.boolean()
15234
+ }))
14935
15235
  })),
14936
15236
  "created_at": zod.string().datetime({ "offset": true }),
14937
15237
  "updated_at": zod.string().datetime({ "offset": true })
@@ -14982,6 +15282,7 @@ var ListIntakeBundlesResponse = zod.object({
14982
15282
  "deferred_until": zod.union([zod.string().datetime({ "offset": true }), zod.null()]),
14983
15283
  "routing_reason": zod.union([zod.string(), zod.null()]),
14984
15284
  "summary": zod.string(),
15285
+ "properties": zod.record(zod.string(), zod.string()),
14985
15286
  "delivery_failure": zod.union([zod.string(), zod.null()]),
14986
15287
  "resolved_at": zod.union([zod.string().datetime({ "offset": true }), zod.null()]),
14987
15288
  "resolved_by": zod.union([zod.string().describe('Actor string, e.g. "worker:<workerId>" or "user:<profileId>".'), zod.null()]),
@@ -15008,7 +15309,8 @@ var resolveIntakeBundleBodyThreeReasonMax = 1e4;
15008
15309
  var ResolveIntakeBundleBody = zod.union([zod.object({
15009
15310
  "destination": zod.literal("route"),
15010
15311
  "route_id": zod.string().uuid(),
15011
- "reason": zod.string().min(1).max(resolveIntakeBundleBodyOneReasonMax).optional().describe("Why you chose this destination.")
15312
+ "reason": zod.string().min(1).max(resolveIntakeBundleBodyOneReasonMax).optional().describe("Why you chose this destination."),
15313
+ "properties": zod.record(zod.string(), zod.string().min(1)).optional().describe("Values for the route's properties, by name. Every required property needs one.")
15012
15314
  }), zod.object({
15013
15315
  "destination": zod.literal("ignore"),
15014
15316
  "reason": zod.string().min(1).max(resolveIntakeBundleBodyTwoReasonMax).optional().describe("Why you chose this destination.")
@@ -15027,6 +15329,7 @@ var ResolveIntakeBundleResponse = zod.object({
15027
15329
  "deferred_until": zod.union([zod.string().datetime({ "offset": true }), zod.null()]),
15028
15330
  "routing_reason": zod.union([zod.string(), zod.null()]),
15029
15331
  "summary": zod.string(),
15332
+ "properties": zod.record(zod.string(), zod.string()),
15030
15333
  "delivery_failure": zod.union([zod.string(), zod.null()]),
15031
15334
  "resolved_at": zod.union([zod.string().datetime({ "offset": true }), zod.null()]),
15032
15335
  "resolved_by": zod.union([zod.string().describe('Actor string, e.g. "worker:<workerId>" or "user:<profileId>".'), zod.null()]),
@@ -15127,7 +15430,7 @@ var GetProfileResponse = zod.object({
15127
15430
  "last_name": zod.union([zod.string(), zod.null()]),
15128
15431
  "email": zod.string(),
15129
15432
  "role": zod.enum(["admin", "avallon_admin", "member"]),
15130
- "permissions": zod.array(zod.enum(["voice-agents:read", "voice-agents:write", "voice-agents:promote", "tools:write", "tools:execute", "tools:promote", "tool-calls:read", "extractors:write", "inboxes:write", "inboxes:send", "artifacts:write", "api-keys:write", "teams:write", "cases:write", "cases:delete", "case-types:read", "case-types:create", "case-types:write", "forms:read", "forms:create", "forms:write", "forms:request", "forms:promote", "information-requests:write", "information-requests:resolve", "information-requests:delete", "feedback:write", "outbound-jobs:write", "outbound-jobs:schedule", "calls:monitor", "workers:read", "workers:create", "workers:write", "workers:execute", "workers:write-mcp", "workers:run", "workers:promote", "chat-agents:write", "evaluators:write", "intakes:write", "intakes:review", "notifications:write", "prompts:read", "prompts:write", "secrets:read", "secrets:write", "identity-providers:write", "schedules:read", "schedules:write", "org-units:write", "tenants:write", "analytics:view-cost"])),
15433
+ "permissions": zod.array(zod.enum(["voice-agents:read", "voice-agents:write", "voice-agents:promote", "tools:write", "tools:execute", "tools:promote", "tool-calls:read", "extractors:write", "inboxes:write", "inboxes:send", "artifacts:write", "api-keys:write", "teams:write", "cases:write", "cases:delete", "case-types:read", "case-types:create", "case-types:write", "forms:read", "forms:create", "forms:write", "forms:request", "forms:promote", "information-requests:write", "information-requests:resolve", "information-requests:delete", "feedback:write", "outbound-jobs:write", "outbound-jobs:schedule", "calls:monitor", "workers:read", "workers:create", "workers:write", "workers:execute", "workers:write-mcp", "workers:run", "workers:promote", "chat-agents:write", "evaluators:write", "intakes:write", "intakes:review", "notifications:write", "prompts:read", "prompts:write", "secrets:read", "secrets:write", "identity-providers:write", "schedules:read", "schedules:write", "org-units:write", "ledgers:write", "tenants:write", "analytics:view-cost"])),
15131
15434
  "tenants": zod.object({
15132
15435
  "active": zod.object({
15133
15436
  "id": zod.string(),
@@ -15859,6 +16162,157 @@ var DeleteOrgUnitParams = zod.object({
15859
16162
  "orgUnitId": zod.string().uuid()
15860
16163
  });
15861
16164
  var DeleteOrgUnitResponse = zod.void();
16165
+ var createLedgerBodyNameMax = 200;
16166
+ var createLedgerBodyAccountsItemNameRegExp = new RegExp("^[a-z0-9_]{1,100}$");
16167
+ var createLedgerBodyAccountsDefault = [];
16168
+ var createLedgerBodyAccountsMax = 100;
16169
+ var CreateLedgerBody = zod.object({
16170
+ "name": zod.string().min(1).max(createLedgerBodyNameMax).describe('Name of the ledger, e.g. "Demo client claims account"'),
16171
+ "environment": zod.enum(["live", "test"]).optional().describe("Environment the ledger belongs to. Defaults to `live`."),
16172
+ "accounts": zod.array(zod.object({
16173
+ "name": zod.string().regex(createLedgerBodyAccountsItemNameRegExp).describe('Name of the account within the ledger, e.g. "cash"'),
16174
+ "kind": zod.enum(["money", "estimate"]).describe("`money` for accounts that follow real amounts, `estimate` for estimates such as reserves.")
16175
+ })).max(createLedgerBodyAccountsMax).default(createLedgerBodyAccountsDefault).describe("Accounts to create with the ledger. The ledger and all accounts are created together, or nothing is.")
16176
+ });
16177
+ var CreateLedgerResponse = zod.object({
16178
+ "data": zod.object({
16179
+ "id": zod.string().uuid(),
16180
+ "name": zod.string(),
16181
+ "environment": zod.enum(["live", "test"]),
16182
+ "created_at": zod.string().datetime({ "offset": true }),
16183
+ "accounts": zod.array(zod.object({
16184
+ "id": zod.string().uuid(),
16185
+ "name": zod.string(),
16186
+ "kind": zod.enum(["money", "estimate"]).describe("`money` accounts follow real amounts, `estimate` accounts hold estimates such as reserves. A booking never crosses kinds."),
16187
+ "created_at": zod.string().datetime({ "offset": true })
16188
+ }))
16189
+ }),
16190
+ "message": zod.string()
16191
+ });
16192
+ var listLedgersQueryCountDefault = 50;
16193
+ var listLedgersQueryCountMax = 100;
16194
+ var listLedgersQueryOffsetDefault = 0;
16195
+ var listLedgersQueryOffsetMin = 0;
16196
+ var listLedgersQuerySortByDefault = `name`;
16197
+ var listLedgersQuerySortOrderDefault = `asc`;
16198
+ var ListLedgersQueryParams = zod.object({
16199
+ "count": zod.number().min(1).max(listLedgersQueryCountMax).default(listLedgersQueryCountDefault),
16200
+ "offset": zod.number().min(listLedgersQueryOffsetMin).default(listLedgersQueryOffsetDefault),
16201
+ "sort_by": zod.enum(["name", "created_at"]).default(listLedgersQuerySortByDefault),
16202
+ "sort_order": zod.enum(["asc", "desc"]).default(listLedgersQuerySortOrderDefault)
16203
+ });
16204
+ var ListLedgersResponse = zod.object({
16205
+ "data": zod.array(zod.object({
16206
+ "id": zod.string().uuid(),
16207
+ "name": zod.string(),
16208
+ "environment": zod.enum(["live", "test"]),
16209
+ "created_at": zod.string().datetime({ "offset": true })
16210
+ })),
16211
+ "message": zod.string(),
16212
+ "meta": zod.object({
16213
+ "total": zod.number()
16214
+ })
16215
+ });
16216
+ var CreateLedgerAccountParams = zod.object({
16217
+ "ledgerId": zod.string().uuid()
16218
+ });
16219
+ var createLedgerAccountBodyNameRegExp = new RegExp("^[a-z0-9_]{1,100}$");
16220
+ var CreateLedgerAccountBody = zod.object({
16221
+ "name": zod.string().regex(createLedgerAccountBodyNameRegExp).describe('Name of the account within the ledger, e.g. "cash"'),
16222
+ "kind": zod.enum(["money", "estimate"]).describe("`money` for accounts that follow real amounts, `estimate` for estimates such as reserves.")
16223
+ });
16224
+ var CreateLedgerAccountResponse = zod.object({
16225
+ "data": zod.object({
16226
+ "id": zod.string().uuid(),
16227
+ "name": zod.string(),
16228
+ "kind": zod.enum(["money", "estimate"]).describe("`money` accounts follow real amounts, `estimate` accounts hold estimates such as reserves. A booking never crosses kinds."),
16229
+ "created_at": zod.string().datetime({ "offset": true })
16230
+ }),
16231
+ "message": zod.string()
16232
+ });
16233
+ var ListLedgerAccountsParams = zod.object({
16234
+ "ledgerId": zod.string().uuid()
16235
+ });
16236
+ var ListLedgerAccountsQueryParams = zod.object({
16237
+ "case_id": zod.string().min(1).optional().describe("Count only the bookings of this case. Omit for the balances of the whole ledger.")
16238
+ });
16239
+ var listLedgerAccountsResponseDataItemBalanceCentsMin = -9007199254740991;
16240
+ var listLedgerAccountsResponseDataItemBalanceCentsMax = 9007199254740991;
16241
+ var ListLedgerAccountsResponse = zod.object({
16242
+ "data": zod.array(zod.object({
16243
+ "id": zod.string().uuid(),
16244
+ "name": zod.string(),
16245
+ "kind": zod.enum(["money", "estimate"]).describe("`money` accounts follow real amounts, `estimate` accounts hold estimates such as reserves. A booking never crosses kinds."),
16246
+ "created_at": zod.string().datetime({ "offset": true }),
16247
+ "balance_cents": zod.number().int().min(listLedgerAccountsResponseDataItemBalanceCentsMin).max(listLedgerAccountsResponseDataItemBalanceCentsMax).describe("Everything booked into the account minus everything booked out of it, in cents. Can be negative.")
16248
+ })),
16249
+ "message": zod.string()
16250
+ });
16251
+ var CreateLedgerBookingParams = zod.object({
16252
+ "ledgerId": zod.string().uuid()
16253
+ });
16254
+ var createLedgerBookingBodyFromAccountRegExp = new RegExp("^[a-z0-9_]{1,100}$");
16255
+ var createLedgerBookingBodyToAccountRegExp = new RegExp("^[a-z0-9_]{1,100}$");
16256
+ var createLedgerBookingBodyAmountCentsMax = 9007199254740991;
16257
+ var createLedgerBookingBodyMemoMax = 500;
16258
+ var createLedgerBookingBodyIdempotencyKeyMax = 200;
16259
+ var CreateLedgerBookingBody = zod.object({
16260
+ "from_account": zod.string().regex(createLedgerBookingBodyFromAccountRegExp).describe("Name of the account the amount is taken out of"),
16261
+ "to_account": zod.string().regex(createLedgerBookingBodyToAccountRegExp).describe("Name of the account the amount is put into. Must have the same kind as `from_account`."),
16262
+ "amount_cents": zod.number().int().min(1).max(createLedgerBookingBodyAmountCentsMax).describe("Amount in whole cents, above zero"),
16263
+ "case_id": zod.string().min(1).optional().describe("Case the booking belongs to. Omit for a booking with no case."),
16264
+ "memo": zod.string().min(1).max(createLedgerBookingBodyMemoMax).optional().describe('Free text for people, e.g. "Mock check 10001"'),
16265
+ "idempotency_key": zod.string().min(1).max(createLedgerBookingBodyIdempotencyKeyMax).describe("Unique within the ledger. Sending the same key with the same content again returns the first booking and books nothing; the same key with different content returns 409.")
16266
+ });
16267
+ var createLedgerBookingResponseDataAmountCentsMax = 9007199254740991;
16268
+ var CreateLedgerBookingResponse = zod.object({
16269
+ "data": zod.object({
16270
+ "id": zod.string().uuid(),
16271
+ "from_account": zod.string().describe("Account the amount was taken out of"),
16272
+ "to_account": zod.string().describe("Account the amount was put into"),
16273
+ "amount_cents": zod.number().int().min(1).max(createLedgerBookingResponseDataAmountCentsMax),
16274
+ "case_id": zod.union([zod.string(), zod.null()]).describe("Case the booking belongs to. Null for a booking with no case."),
16275
+ "memo": zod.union([zod.string(), zod.null()]),
16276
+ "created_by": zod.string(),
16277
+ "created_at": zod.string().datetime({ "offset": true })
16278
+ }),
16279
+ "message": zod.string()
16280
+ });
16281
+ var ListLedgerBookingsParams = zod.object({
16282
+ "ledgerId": zod.string().uuid()
16283
+ });
16284
+ var listLedgerBookingsQueryAccountRegExp = new RegExp("^[a-z0-9_]{1,100}$");
16285
+ var listLedgerBookingsQueryCountDefault = 50;
16286
+ var listLedgerBookingsQueryCountMax = 100;
16287
+ var listLedgerBookingsQueryOffsetDefault = 0;
16288
+ var listLedgerBookingsQueryOffsetMin = 0;
16289
+ var listLedgerBookingsQuerySortByDefault = `created_at`;
16290
+ var listLedgerBookingsQuerySortOrderDefault = `desc`;
16291
+ var ListLedgerBookingsQueryParams = zod.object({
16292
+ "account": zod.string().regex(listLedgerBookingsQueryAccountRegExp).optional().describe("Only bookings into or out of this account"),
16293
+ "case_id": zod.string().min(1).optional().describe("Only bookings of this case"),
16294
+ "count": zod.number().min(1).max(listLedgerBookingsQueryCountMax).default(listLedgerBookingsQueryCountDefault),
16295
+ "offset": zod.number().min(listLedgerBookingsQueryOffsetMin).default(listLedgerBookingsQueryOffsetDefault),
16296
+ "sort_by": zod.enum(["created_at"]).default(listLedgerBookingsQuerySortByDefault),
16297
+ "sort_order": zod.enum(["asc", "desc"]).default(listLedgerBookingsQuerySortOrderDefault)
16298
+ });
16299
+ var listLedgerBookingsResponseDataItemAmountCentsMax = 9007199254740991;
16300
+ var ListLedgerBookingsResponse = zod.object({
16301
+ "data": zod.array(zod.object({
16302
+ "id": zod.string().uuid(),
16303
+ "from_account": zod.string().describe("Account the amount was taken out of"),
16304
+ "to_account": zod.string().describe("Account the amount was put into"),
16305
+ "amount_cents": zod.number().int().min(1).max(listLedgerBookingsResponseDataItemAmountCentsMax),
16306
+ "case_id": zod.union([zod.string(), zod.null()]).describe("Case the booking belongs to. Null for a booking with no case."),
16307
+ "memo": zod.union([zod.string(), zod.null()]),
16308
+ "created_by": zod.string(),
16309
+ "created_at": zod.string().datetime({ "offset": true })
16310
+ })),
16311
+ "message": zod.string(),
16312
+ "meta": zod.object({
16313
+ "total": zod.number()
16314
+ })
16315
+ });
15862
16316
  var listDispatchesQueryCountDefault = 50;
15863
16317
  var listDispatchesQueryCountMax = 100;
15864
16318
  var listDispatchesQueryOffsetDefault = 0;
@@ -20251,6 +20705,106 @@ var createMcpServer = (options) => {
20251
20705
  signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20252
20706
  })
20253
20707
  );
20708
+ tools.createLedger = server2.registerTool(
20709
+ "createLedger",
20710
+ {
20711
+ title: "Create a ledger",
20712
+ description: "Create a ledger for one owner of money, such as a client or program with its own bank account. Pass `accounts` to create its accounts in the same call; more can be added later. Returns 400 if an account name is listed more than once. Requires the `ledgers:write` permission.",
20713
+ inputSchema: {
20714
+ bodyParams: CreateLedgerBody.optional()
20715
+ },
20716
+ outputSchema: CreateLedgerResponse,
20717
+ annotations: { destructiveHint: true }
20718
+ },
20719
+ (args, ctx) => createLedgerHandler(args, {
20720
+ ...options,
20721
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20722
+ })
20723
+ );
20724
+ tools.listLedgers = server2.registerTool(
20725
+ "listLedgers",
20726
+ {
20727
+ title: "List ledgers",
20728
+ description: "List the organization's ledgers, paginated.",
20729
+ inputSchema: {
20730
+ queryParams: ListLedgersQueryParams
20731
+ },
20732
+ outputSchema: ListLedgersResponse,
20733
+ annotations: { readOnlyHint: true }
20734
+ },
20735
+ (args, ctx) => listLedgersHandler(args, {
20736
+ ...options,
20737
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20738
+ })
20739
+ );
20740
+ tools.createLedgerAccount = server2.registerTool(
20741
+ "createLedgerAccount",
20742
+ {
20743
+ title: "Create a ledger account",
20744
+ description: "Add a named account to a ledger. Returns 409 if the name already exists in this ledger. Requires the `ledgers:write` permission.",
20745
+ inputSchema: {
20746
+ pathParams: CreateLedgerAccountParams,
20747
+ bodyParams: CreateLedgerAccountBody.optional()
20748
+ },
20749
+ outputSchema: CreateLedgerAccountResponse,
20750
+ annotations: { destructiveHint: true }
20751
+ },
20752
+ (args, ctx) => createLedgerAccountHandler(args, {
20753
+ ...options,
20754
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20755
+ })
20756
+ );
20757
+ tools.listLedgerAccounts = server2.registerTool(
20758
+ "listLedgerAccounts",
20759
+ {
20760
+ title: "List ledger accounts with balances",
20761
+ description: "List every account of a ledger with its balance, for the whole ledger or for one case. Balances are summed from the bookings on every read.",
20762
+ inputSchema: {
20763
+ pathParams: ListLedgerAccountsParams,
20764
+ queryParams: ListLedgerAccountsQueryParams
20765
+ },
20766
+ outputSchema: ListLedgerAccountsResponse,
20767
+ annotations: { readOnlyHint: true }
20768
+ },
20769
+ (args, ctx) => listLedgerAccountsHandler(args, {
20770
+ ...options,
20771
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20772
+ })
20773
+ );
20774
+ tools.createLedgerBooking = server2.registerTool(
20775
+ "createLedgerBooking",
20776
+ {
20777
+ title: "Create a ledger booking",
20778
+ description: "Move an amount out of one account and into another. Bookings are never changed or deleted: to correct one, book the same amount in the opposite direction. Returns 404 if an account or the case is unknown and 400 if the two accounts have different kinds. Requires the `ledgers:write` permission.",
20779
+ inputSchema: {
20780
+ pathParams: CreateLedgerBookingParams,
20781
+ bodyParams: CreateLedgerBookingBody.optional()
20782
+ },
20783
+ outputSchema: CreateLedgerBookingResponse,
20784
+ annotations: { destructiveHint: true }
20785
+ },
20786
+ (args, ctx) => createLedgerBookingHandler(args, {
20787
+ ...options,
20788
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20789
+ })
20790
+ );
20791
+ tools.listLedgerBookings = server2.registerTool(
20792
+ "listLedgerBookings",
20793
+ {
20794
+ title: "List ledger bookings",
20795
+ description: "List the bookings of a ledger, newest first, paginated. Filter by account or case.",
20796
+ inputSchema: {
20797
+ pathParams: ListLedgerBookingsParams,
20798
+ queryParams: ListLedgerBookingsQueryParams
20799
+ },
20800
+ outputSchema: ListLedgerBookingsResponse,
20801
+ annotations: { readOnlyHint: true }
20802
+ },
20803
+ (args, ctx) => listLedgerBookingsHandler(args, {
20804
+ ...options,
20805
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20806
+ })
20807
+ );
20254
20808
  tools.listDispatches = server2.registerTool(
20255
20809
  "listDispatches",
20256
20810
  {
@@ -21062,4 +21616,4 @@ var transport = new StdioServerTransport();
21062
21616
  server.connect(transport).then(() => {
21063
21617
  console.error("MCP server running on stdio");
21064
21618
  }).catch(console.error);
21065
- //# sourceMappingURL=server-JLVG5YXW.js.map
21619
+ //# sourceMappingURL=server-YZTZCXBV.js.map