@avallon-labs/mcp 72.3.0-staging.1539 → 72.4.0-staging.1540

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-GYI5MNCW.js");
59
+ await import("./server-JLVG5YXW.js");
60
60
  //# sourceMappingURL=index.js.map
@@ -3741,6 +3741,104 @@ var deleteSchedule = async (scheduleId, options) => {
3741
3741
  const data = body ? JSON.parse(body) : {};
3742
3742
  return { data, status: res.status, headers: res.headers };
3743
3743
  };
3744
+ var getCreateOrgUnitUrl = () => {
3745
+ return `/v1/org-units`;
3746
+ };
3747
+ var createOrgUnit = async (createOrgUnitBody, options) => {
3748
+ const getHeaders = (h) => {
3749
+ if (!h) return {};
3750
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
3751
+ if (Array.isArray(h)) return Object.fromEntries(h);
3752
+ return h;
3753
+ };
3754
+ const res = await fetch(
3755
+ getCreateOrgUnitUrl(),
3756
+ {
3757
+ ...options,
3758
+ method: "POST",
3759
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
3760
+ body: JSON.stringify(createOrgUnitBody)
3761
+ }
3762
+ );
3763
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3764
+ const data = body ? JSON.parse(body) : {};
3765
+ return { data, status: res.status, headers: res.headers };
3766
+ };
3767
+ var getListOrgUnitsUrl = (params) => {
3768
+ const normalizedParams = new URLSearchParams();
3769
+ Object.entries(params || {}).forEach(([key, value]) => {
3770
+ if (value !== void 0) {
3771
+ normalizedParams.append(key, value === null ? "null" : String(value));
3772
+ }
3773
+ });
3774
+ const stringifiedParams = normalizedParams.toString();
3775
+ return stringifiedParams.length > 0 ? `/v1/org-units?${stringifiedParams}` : `/v1/org-units`;
3776
+ };
3777
+ var listOrgUnits = async (params, options) => {
3778
+ const res = await fetch(
3779
+ getListOrgUnitsUrl(params),
3780
+ {
3781
+ ...options,
3782
+ method: "GET"
3783
+ }
3784
+ );
3785
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3786
+ const data = body ? JSON.parse(body) : {};
3787
+ return { data, status: res.status, headers: res.headers };
3788
+ };
3789
+ var getGetOrgUnitUrl = (orgUnitId) => {
3790
+ return `/v1/org-units/${orgUnitId}`;
3791
+ };
3792
+ var getOrgUnit = async (orgUnitId, options) => {
3793
+ const res = await fetch(
3794
+ getGetOrgUnitUrl(orgUnitId),
3795
+ {
3796
+ ...options,
3797
+ method: "GET"
3798
+ }
3799
+ );
3800
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3801
+ const data = body ? JSON.parse(body) : {};
3802
+ return { data, status: res.status, headers: res.headers };
3803
+ };
3804
+ var getUpdateOrgUnitUrl = (orgUnitId) => {
3805
+ return `/v1/org-units/${orgUnitId}`;
3806
+ };
3807
+ var updateOrgUnit = async (orgUnitId, updateOrgUnitBody, options) => {
3808
+ const getHeaders = (h) => {
3809
+ if (!h) return {};
3810
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
3811
+ if (Array.isArray(h)) return Object.fromEntries(h);
3812
+ return h;
3813
+ };
3814
+ const res = await fetch(
3815
+ getUpdateOrgUnitUrl(orgUnitId),
3816
+ {
3817
+ ...options,
3818
+ method: "PATCH",
3819
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
3820
+ body: JSON.stringify(updateOrgUnitBody)
3821
+ }
3822
+ );
3823
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3824
+ const data = body ? JSON.parse(body) : {};
3825
+ return { data, status: res.status, headers: res.headers };
3826
+ };
3827
+ var getDeleteOrgUnitUrl = (orgUnitId) => {
3828
+ return `/v1/org-units/${orgUnitId}`;
3829
+ };
3830
+ var deleteOrgUnit = async (orgUnitId, options) => {
3831
+ const res = await fetch(
3832
+ getDeleteOrgUnitUrl(orgUnitId),
3833
+ {
3834
+ ...options,
3835
+ method: "DELETE"
3836
+ }
3837
+ );
3838
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
3839
+ const data = body ? JSON.parse(body) : void 0;
3840
+ return { data, status: res.status, headers: res.headers };
3841
+ };
3744
3842
  var getListDispatchesUrl = (params) => {
3745
3843
  const normalizedParams = new URLSearchParams();
3746
3844
  Object.entries(params || {}).forEach(([key, value]) => {
@@ -8945,6 +9043,121 @@ var deleteScheduleHandler = async (args, options) => {
8945
9043
  structuredContent: res.data
8946
9044
  };
8947
9045
  };
9046
+ var createOrgUnitHandler = async (args, options) => {
9047
+ const res = await createOrgUnit(args.bodyParams, options);
9048
+ if (res.status >= 400) {
9049
+ return {
9050
+ content: [
9051
+ {
9052
+ type: "text",
9053
+ text: JSON.stringify(res.data ?? null)
9054
+ }
9055
+ ],
9056
+ isError: true
9057
+ };
9058
+ }
9059
+ return {
9060
+ content: [
9061
+ {
9062
+ type: "text",
9063
+ text: JSON.stringify(res.data ?? null)
9064
+ }
9065
+ ],
9066
+ structuredContent: res.data
9067
+ };
9068
+ };
9069
+ var listOrgUnitsHandler = async (args, options) => {
9070
+ const res = await listOrgUnits(args.queryParams, options);
9071
+ if (res.status >= 400) {
9072
+ return {
9073
+ content: [
9074
+ {
9075
+ type: "text",
9076
+ text: JSON.stringify(res.data ?? null)
9077
+ }
9078
+ ],
9079
+ isError: true
9080
+ };
9081
+ }
9082
+ return {
9083
+ content: [
9084
+ {
9085
+ type: "text",
9086
+ text: JSON.stringify(res.data ?? null)
9087
+ }
9088
+ ],
9089
+ structuredContent: res.data
9090
+ };
9091
+ };
9092
+ var getOrgUnitHandler = async (args, options) => {
9093
+ const res = await getOrgUnit(args.pathParams.orgUnitId, options);
9094
+ if (res.status >= 400) {
9095
+ return {
9096
+ content: [
9097
+ {
9098
+ type: "text",
9099
+ text: JSON.stringify(res.data ?? null)
9100
+ }
9101
+ ],
9102
+ isError: true
9103
+ };
9104
+ }
9105
+ return {
9106
+ content: [
9107
+ {
9108
+ type: "text",
9109
+ text: JSON.stringify(res.data ?? null)
9110
+ }
9111
+ ],
9112
+ structuredContent: res.data
9113
+ };
9114
+ };
9115
+ var updateOrgUnitHandler = async (args, options) => {
9116
+ const res = await updateOrgUnit(args.pathParams.orgUnitId, args.bodyParams, options);
9117
+ if (res.status >= 400) {
9118
+ return {
9119
+ content: [
9120
+ {
9121
+ type: "text",
9122
+ text: JSON.stringify(res.data ?? null)
9123
+ }
9124
+ ],
9125
+ isError: true
9126
+ };
9127
+ }
9128
+ return {
9129
+ content: [
9130
+ {
9131
+ type: "text",
9132
+ text: JSON.stringify(res.data ?? null)
9133
+ }
9134
+ ],
9135
+ structuredContent: res.data
9136
+ };
9137
+ };
9138
+ var deleteOrgUnitHandler = async (args, options) => {
9139
+ const res = await deleteOrgUnit(args.pathParams.orgUnitId, options);
9140
+ if (res.status >= 400) {
9141
+ return {
9142
+ content: [
9143
+ {
9144
+ type: "text",
9145
+ text: JSON.stringify(res.data ?? null)
9146
+ }
9147
+ ],
9148
+ isError: true
9149
+ };
9150
+ }
9151
+ return {
9152
+ content: [
9153
+ {
9154
+ type: "text",
9155
+ text: JSON.stringify(res.data ?? null)
9156
+ }
9157
+ ],
9158
+ structuredContent: res.data
9159
+ };
9160
+ };
8948
9161
  var listDispatchesHandler = async (args, options) => {
8949
9162
  const res = await listDispatches(args.queryParams, options);
8950
9163
  if (res.status >= 400) {
@@ -14914,7 +15127,7 @@ var GetProfileResponse = zod.object({
14914
15127
  "last_name": zod.union([zod.string(), zod.null()]),
14915
15128
  "email": zod.string(),
14916
15129
  "role": zod.enum(["admin", "avallon_admin", "member"]),
14917
- "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", "tenants:write", "analytics:view-cost"])),
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"])),
14918
15131
  "tenants": zod.object({
14919
15132
  "active": zod.object({
14920
15133
  "id": zod.string(),
@@ -15571,6 +15784,81 @@ var DeleteScheduleResponse = zod.object({
15571
15784
  "data": zod.object({}),
15572
15785
  "message": zod.string()
15573
15786
  });
15787
+ var createOrgUnitBodyNameMax = 200;
15788
+ var CreateOrgUnitBody = zod.object({
15789
+ "name": zod.string().min(1).max(createOrgUnitBodyNameMax).describe('Name of the unit, e.g. "Fire Department"'),
15790
+ "parent_id": zod.string().uuid().optional().describe("Parent unit. Omit for a top-level unit.")
15791
+ });
15792
+ var CreateOrgUnitResponse = zod.object({
15793
+ "data": zod.object({
15794
+ "id": zod.string().uuid(),
15795
+ "parent_id": zod.union([zod.string().uuid(), zod.null()]).describe("Null for a top-level unit"),
15796
+ "name": zod.string(),
15797
+ "created_at": zod.string().datetime({ "offset": true }),
15798
+ "updated_at": zod.string().datetime({ "offset": true })
15799
+ }),
15800
+ "message": zod.string()
15801
+ });
15802
+ var listOrgUnitsQueryCountDefault = 50;
15803
+ var listOrgUnitsQueryCountMax = 100;
15804
+ var listOrgUnitsQueryOffsetDefault = 0;
15805
+ var listOrgUnitsQueryOffsetMin = 0;
15806
+ var listOrgUnitsQuerySortByDefault = `name`;
15807
+ var listOrgUnitsQuerySortOrderDefault = `asc`;
15808
+ var ListOrgUnitsQueryParams = zod.object({
15809
+ "count": zod.number().min(1).max(listOrgUnitsQueryCountMax).default(listOrgUnitsQueryCountDefault),
15810
+ "offset": zod.number().min(listOrgUnitsQueryOffsetMin).default(listOrgUnitsQueryOffsetDefault),
15811
+ "sort_by": zod.enum(["name", "created_at"]).default(listOrgUnitsQuerySortByDefault),
15812
+ "sort_order": zod.enum(["asc", "desc"]).default(listOrgUnitsQuerySortOrderDefault)
15813
+ });
15814
+ var ListOrgUnitsResponse = zod.object({
15815
+ "data": zod.array(zod.object({
15816
+ "id": zod.string().uuid(),
15817
+ "parent_id": zod.union([zod.string().uuid(), zod.null()]).describe("Null for a top-level unit"),
15818
+ "name": zod.string(),
15819
+ "created_at": zod.string().datetime({ "offset": true }),
15820
+ "updated_at": zod.string().datetime({ "offset": true })
15821
+ })),
15822
+ "message": zod.string(),
15823
+ "meta": zod.object({
15824
+ "total": zod.number()
15825
+ })
15826
+ });
15827
+ var GetOrgUnitParams = zod.object({
15828
+ "orgUnitId": zod.string().uuid()
15829
+ });
15830
+ var GetOrgUnitResponse = zod.object({
15831
+ "data": zod.object({
15832
+ "id": zod.string().uuid(),
15833
+ "parent_id": zod.union([zod.string().uuid(), zod.null()]).describe("Null for a top-level unit"),
15834
+ "name": zod.string(),
15835
+ "created_at": zod.string().datetime({ "offset": true }),
15836
+ "updated_at": zod.string().datetime({ "offset": true }),
15837
+ "children": zod.array(zod.unknown()).describe("Child units, sorted by name")
15838
+ }),
15839
+ "message": zod.string()
15840
+ });
15841
+ var UpdateOrgUnitParams = zod.object({
15842
+ "orgUnitId": zod.string().uuid()
15843
+ });
15844
+ var updateOrgUnitBodyNameMax = 200;
15845
+ var UpdateOrgUnitBody = zod.object({
15846
+ "name": zod.string().min(1).max(updateOrgUnitBodyNameMax).optional().describe('Name of the unit, e.g. "Fire Department"')
15847
+ });
15848
+ var UpdateOrgUnitResponse = zod.object({
15849
+ "data": zod.object({
15850
+ "id": zod.string().uuid(),
15851
+ "parent_id": zod.union([zod.string().uuid(), zod.null()]).describe("Null for a top-level unit"),
15852
+ "name": zod.string(),
15853
+ "created_at": zod.string().datetime({ "offset": true }),
15854
+ "updated_at": zod.string().datetime({ "offset": true })
15855
+ }),
15856
+ "message": zod.string()
15857
+ });
15858
+ var DeleteOrgUnitParams = zod.object({
15859
+ "orgUnitId": zod.string().uuid()
15860
+ });
15861
+ var DeleteOrgUnitResponse = zod.void();
15574
15862
  var listDispatchesQueryCountDefault = 50;
15575
15863
  var listDispatchesQueryCountMax = 100;
15576
15864
  var listDispatchesQueryOffsetDefault = 0;
@@ -19882,6 +20170,87 @@ var createMcpServer = (options) => {
19882
20170
  signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
19883
20171
  })
19884
20172
  );
20173
+ tools.createOrgUnit = server2.registerTool(
20174
+ "createOrgUnit",
20175
+ {
20176
+ title: "Create an org unit",
20177
+ description: "Create a unit in the organization's tree. Requires the `org-units:write` permission.",
20178
+ inputSchema: {
20179
+ bodyParams: CreateOrgUnitBody.optional()
20180
+ },
20181
+ outputSchema: CreateOrgUnitResponse,
20182
+ annotations: { destructiveHint: true }
20183
+ },
20184
+ (args, ctx) => createOrgUnitHandler(args, {
20185
+ ...options,
20186
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20187
+ })
20188
+ );
20189
+ tools.listOrgUnits = server2.registerTool(
20190
+ "listOrgUnits",
20191
+ {
20192
+ title: "List top-level org units",
20193
+ description: "List the organization's top-level units. Get a unit to read its subtree.",
20194
+ inputSchema: {
20195
+ queryParams: ListOrgUnitsQueryParams
20196
+ },
20197
+ outputSchema: ListOrgUnitsResponse,
20198
+ annotations: { readOnlyHint: true }
20199
+ },
20200
+ (args, ctx) => listOrgUnitsHandler(args, {
20201
+ ...options,
20202
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20203
+ })
20204
+ );
20205
+ tools.getOrgUnit = server2.registerTool(
20206
+ "getOrgUnit",
20207
+ {
20208
+ title: "Get an org unit",
20209
+ description: "Retrieve a unit with its whole subtree nested under `children`.",
20210
+ inputSchema: {
20211
+ pathParams: GetOrgUnitParams
20212
+ },
20213
+ outputSchema: GetOrgUnitResponse,
20214
+ annotations: { readOnlyHint: true }
20215
+ },
20216
+ (args, ctx) => getOrgUnitHandler(args, {
20217
+ ...options,
20218
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20219
+ })
20220
+ );
20221
+ tools.updateOrgUnit = server2.registerTool(
20222
+ "updateOrgUnit",
20223
+ {
20224
+ title: "Update an org unit",
20225
+ description: "Update a unit's fields. Requires the `org-units:write` permission.",
20226
+ inputSchema: {
20227
+ pathParams: UpdateOrgUnitParams,
20228
+ bodyParams: UpdateOrgUnitBody.optional()
20229
+ },
20230
+ outputSchema: UpdateOrgUnitResponse,
20231
+ annotations: { destructiveHint: true }
20232
+ },
20233
+ (args, ctx) => updateOrgUnitHandler(args, {
20234
+ ...options,
20235
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20236
+ })
20237
+ );
20238
+ tools.deleteOrgUnit = server2.registerTool(
20239
+ "deleteOrgUnit",
20240
+ {
20241
+ title: "Delete an org unit",
20242
+ description: "Delete a unit together with its whole subtree. Requires the `org-units:write` permission.",
20243
+ inputSchema: {
20244
+ pathParams: DeleteOrgUnitParams
20245
+ },
20246
+ outputSchema: DeleteOrgUnitResponse,
20247
+ annotations: { destructiveHint: true, idempotentHint: true }
20248
+ },
20249
+ (args, ctx) => deleteOrgUnitHandler(args, {
20250
+ ...options,
20251
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
20252
+ })
20253
+ );
19885
20254
  tools.listDispatches = server2.registerTool(
19886
20255
  "listDispatches",
19887
20256
  {
@@ -20693,4 +21062,4 @@ var transport = new StdioServerTransport();
20693
21062
  server.connect(transport).then(() => {
20694
21063
  console.error("MCP server running on stdio");
20695
21064
  }).catch(console.error);
20696
- //# sourceMappingURL=server-GYI5MNCW.js.map
21065
+ //# sourceMappingURL=server-JLVG5YXW.js.map