@headless-lms/server 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/app/community-mail.d.ts +5 -3
- package/dist/app/community-mail.js +60 -12
- package/dist/app/community-mail.js.map +1 -1
- package/dist/app/container.d.ts +24 -3
- package/dist/app/container.js +102 -38
- package/dist/app/container.js.map +1 -1
- package/dist/app/notification-channels.js +1 -0
- package/dist/app/notification-channels.js.map +1 -1
- package/dist/app/notification-reads.d.ts +3 -3
- package/dist/app/notification-reads.js +7 -28
- package/dist/app/notification-reads.js.map +1 -1
- package/dist/app/platform.d.ts +14 -0
- package/dist/app/platform.js +14 -0
- package/dist/app/platform.js.map +1 -0
- package/dist/http/config.d.ts +4 -0
- package/dist/http/errors.js +9 -4
- package/dist/http/errors.js.map +1 -1
- package/dist/http/fastify.d.ts +8 -0
- package/dist/http/mcp/catalogue.d.ts +11 -9
- package/dist/http/mcp/catalogue.js +15 -21
- package/dist/http/mcp/catalogue.js.map +1 -1
- package/dist/http/mcp/challenge.js +3 -3
- package/dist/http/mcp/challenge.js.map +1 -1
- package/dist/http/mcp/route.js +7 -7
- package/dist/http/mcp/route.js.map +1 -1
- package/dist/http/mcp/test-support.d.ts +6 -5
- package/dist/http/mcp/test-support.js +32 -11
- package/dist/http/mcp/test-support.js.map +1 -1
- package/dist/http/mcp/tool.d.ts +3 -9
- package/dist/http/mcp/tool.js +14 -6
- package/dist/http/mcp/tool.js.map +1 -1
- package/dist/http/mcp/tools/automations.js +10 -20
- package/dist/http/mcp/tools/automations.js.map +1 -1
- package/dist/http/mcp/tools/catalog.js +25 -42
- package/dist/http/mcp/tools/catalog.js.map +1 -1
- package/dist/http/mcp/tools/comments.js +9 -19
- package/dist/http/mcp/tools/comments.js.map +1 -1
- package/dist/http/mcp/tools/communities.js +17 -32
- package/dist/http/mcp/tools/communities.js.map +1 -1
- package/dist/http/mcp/tools/community-members.js +9 -16
- package/dist/http/mcp/tools/community-members.js.map +1 -1
- package/dist/http/mcp/tools/community-moderation.js +13 -25
- package/dist/http/mcp/tools/community-moderation.js.map +1 -1
- package/dist/http/mcp/tools/courses.js +11 -21
- package/dist/http/mcp/tools/courses.js.map +1 -1
- package/dist/http/mcp/tools/events.d.ts +6 -0
- package/dist/http/mcp/tools/events.js +170 -0
- package/dist/http/mcp/tools/events.js.map +1 -0
- package/dist/http/mcp/tools/index.d.ts +5 -1
- package/dist/http/mcp/tools/index.js +45 -10
- package/dist/http/mcp/tools/index.js.map +1 -1
- package/dist/http/mcp/tools/organization.d.ts +6 -0
- package/dist/http/mcp/tools/organization.js +214 -0
- package/dist/http/mcp/tools/organization.js.map +1 -0
- package/dist/http/mcp/tools/people.js +30 -49
- package/dist/http/mcp/tools/people.js.map +1 -1
- package/dist/http/plugins/auth.js +37 -8
- package/dist/http/plugins/auth.js.map +1 -1
- package/dist/http/plugins/error-handler.d.ts +5 -1
- package/dist/http/plugins/error-handler.js +10 -2
- package/dist/http/plugins/error-handler.js.map +1 -1
- package/dist/http/plugins/openapi.js +18 -2
- package/dist/http/plugins/openapi.js.map +1 -1
- package/dist/http/plugins/platform.d.ts +7 -0
- package/dist/http/plugins/platform.js +13 -0
- package/dist/http/plugins/platform.js.map +1 -0
- package/dist/http/routes/access.js +54 -36
- package/dist/http/routes/access.js.map +1 -1
- package/dist/http/routes/activities.js +45 -45
- package/dist/http/routes/activities.js.map +1 -1
- package/dist/http/routes/assets.js +30 -65
- package/dist/http/routes/assets.js.map +1 -1
- package/dist/http/routes/automations.js +37 -42
- package/dist/http/routes/automations.js.map +1 -1
- package/dist/http/routes/bundles.js +33 -36
- package/dist/http/routes/bundles.js.map +1 -1
- package/dist/http/routes/communities.js +93 -145
- package/dist/http/routes/communities.js.map +1 -1
- package/dist/http/routes/community-moderation.js +83 -137
- package/dist/http/routes/community-moderation.js.map +1 -1
- package/dist/http/routes/course-analytics.js +32 -15
- package/dist/http/routes/course-analytics.js.map +1 -1
- package/dist/http/routes/courses.js +25 -32
- package/dist/http/routes/courses.js.map +1 -1
- package/dist/http/routes/dashboard.js +9 -9
- package/dist/http/routes/dashboard.js.map +1 -1
- package/dist/http/routes/discussion.js +21 -39
- package/dist/http/routes/discussion.js.map +1 -1
- package/dist/http/routes/downloads.js +41 -47
- package/dist/http/routes/downloads.js.map +1 -1
- package/dist/http/routes/entitlements.js +19 -23
- package/dist/http/routes/entitlements.js.map +1 -1
- package/dist/http/routes/events.d.ts +7 -0
- package/dist/http/routes/events.js +333 -0
- package/dist/http/routes/events.js.map +1 -0
- package/dist/http/routes/integrations.js +40 -73
- package/dist/http/routes/integrations.js.map +1 -1
- package/dist/http/routes/member/assets.js +10 -13
- package/dist/http/routes/member/assets.js.map +1 -1
- package/dist/http/routes/member/chats.js +170 -47
- package/dist/http/routes/member/chats.js.map +1 -1
- package/dist/http/routes/member/comments.js +65 -26
- package/dist/http/routes/member/comments.js.map +1 -1
- package/dist/http/routes/member/community.js +45 -52
- package/dist/http/routes/member/community.js.map +1 -1
- package/dist/http/routes/member/courses.js +12 -19
- package/dist/http/routes/member/courses.js.map +1 -1
- package/dist/http/routes/member/devices.js +9 -10
- package/dist/http/routes/member/devices.js.map +1 -1
- package/dist/http/routes/member/downloads.js +6 -9
- package/dist/http/routes/member/downloads.js.map +1 -1
- package/dist/http/routes/member/events.d.ts +7 -0
- package/dist/http/routes/member/events.js +386 -0
- package/dist/http/routes/member/events.js.map +1 -0
- package/dist/http/routes/member/files.js +88 -46
- package/dist/http/routes/member/files.js.map +1 -1
- package/dist/http/routes/member/index.js +2 -0
- package/dist/http/routes/member/index.js.map +1 -1
- package/dist/http/routes/member/notification-settings.js +15 -23
- package/dist/http/routes/member/notification-settings.js.map +1 -1
- package/dist/http/routes/member/notifications.js +16 -16
- package/dist/http/routes/member/notifications.js.map +1 -1
- package/dist/http/routes/member/org.js +5 -15
- package/dist/http/routes/member/org.js.map +1 -1
- package/dist/http/routes/member/posts.js +67 -68
- package/dist/http/routes/member/posts.js.map +1 -1
- package/dist/http/routes/member/profile.js +15 -6
- package/dist/http/routes/member/profile.js.map +1 -1
- package/dist/http/routes/member/progress.js +7 -11
- package/dist/http/routes/member/progress.js.map +1 -1
- package/dist/http/routes/organizations.js +319 -135
- package/dist/http/routes/organizations.js.map +1 -1
- package/dist/http/routes/platform.d.ts +7 -0
- package/dist/http/routes/platform.js +61 -0
- package/dist/http/routes/platform.js.map +1 -0
- package/dist/http/routes/students.js +12 -75
- package/dist/http/routes/students.js.map +1 -1
- package/dist/http/routes/webhooks.js +30 -39
- package/dist/http/routes/webhooks.js.map +1 -1
- package/dist/http/routes.js +9 -0
- package/dist/http/routes.js.map +1 -1
- package/dist/http/schemas/access.d.ts +346 -64
- package/dist/http/schemas/access.js +39 -12
- package/dist/http/schemas/access.js.map +1 -1
- package/dist/http/schemas/assets.d.ts +8 -3
- package/dist/http/schemas/assets.js +6 -5
- package/dist/http/schemas/assets.js.map +1 -1
- package/dist/http/schemas/automations.d.ts +4 -4
- package/dist/http/schemas/chats.d.ts +216 -37
- package/dist/http/schemas/chats.js +13 -4
- package/dist/http/schemas/chats.js.map +1 -1
- package/dist/http/schemas/community.d.ts +105 -31
- package/dist/http/schemas/community.js +25 -9
- package/dist/http/schemas/community.js.map +1 -1
- package/dist/http/schemas/course-analytics.d.ts +51 -1
- package/dist/http/schemas/course-analytics.js +19 -1
- package/dist/http/schemas/course-analytics.js.map +1 -1
- package/dist/http/schemas/dashboard.d.ts +1 -0
- package/dist/http/schemas/dashboard.js +2 -1
- package/dist/http/schemas/dashboard.js.map +1 -1
- package/dist/http/schemas/discussion.d.ts +22 -72
- package/dist/http/schemas/discussion.js +2 -2
- package/dist/http/schemas/discussion.js.map +1 -1
- package/dist/http/schemas/entitlements.d.ts +9 -12
- package/dist/http/schemas/entitlements.js +11 -5
- package/dist/http/schemas/entitlements.js.map +1 -1
- package/dist/http/schemas/events.d.ts +527 -0
- package/dist/http/schemas/events.js +64 -0
- package/dist/http/schemas/events.js.map +1 -0
- package/dist/http/schemas/files.d.ts +24 -5
- package/dist/http/schemas/files.js +15 -2
- package/dist/http/schemas/files.js.map +1 -1
- package/dist/http/schemas/index.d.ts +11 -9
- package/dist/http/schemas/index.js +11 -9
- package/dist/http/schemas/invites.d.ts +3 -47
- package/dist/http/schemas/invites.js +4 -25
- package/dist/http/schemas/invites.js.map +1 -1
- package/dist/http/schemas/member.d.ts +94 -7
- package/dist/http/schemas/member.js +7 -3
- package/dist/http/schemas/member.js.map +1 -1
- package/dist/http/schemas/members.d.ts +329 -65
- package/dist/http/schemas/members.js +67 -25
- package/dist/http/schemas/members.js.map +1 -1
- package/dist/http/schemas/notifications.d.ts +58 -54
- package/dist/http/schemas/platform.d.ts +38 -0
- package/dist/http/schemas/platform.js +19 -0
- package/dist/http/schemas/platform.js.map +1 -0
- package/dist/http/schemas/posts.d.ts +55 -35
- package/dist/http/schemas/posts.js +4 -4
- package/dist/http/schemas/posts.js.map +1 -1
- package/dist/http/schemas/profile.d.ts +1 -1
- package/dist/http/schemas/shared.d.ts +1 -11
- package/dist/http/schemas/shared.js +1 -10
- package/dist/http/schemas/shared.js.map +1 -1
- package/dist/http/schemas/students.d.ts +22 -0
- package/dist/http/schemas/students.js +3 -1
- package/dist/http/schemas/students.js.map +1 -1
- package/dist/http/scope.d.ts +9 -13
- package/dist/http/scope.js +29 -40
- package/dist/http/scope.js.map +1 -1
- package/dist/http/server.js +9 -0
- package/dist/http/server.js.map +1 -1
- package/dist/http/shutdown.d.ts +11 -0
- package/dist/http/shutdown.js +40 -0
- package/dist/http/shutdown.js.map +1 -0
- package/dist/http/sse.d.ts +19 -0
- package/dist/http/sse.js +104 -0
- package/dist/http/sse.js.map +1 -0
- package/dist/http/test-caller.d.ts +13 -0
- package/dist/http/test-caller.js +14 -0
- package/dist/http/test-caller.js.map +1 -0
- package/dist/http/well-known.js +2 -2
- package/dist/http/well-known.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/packages/server/package.js +1 -1
- package/package.json +7 -6
- package/dist/http/routes/member/actor.d.ts +0 -14
- package/dist/http/routes/member/actor.js +0 -11
- package/dist/http/routes/member/actor.js.map +0 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { PageQuery } from "../../schemas/shared.js";
|
|
2
|
+
import { AddEventAsset, AddEventAttendee, CreateEvent, EventAssetParams, EventAttendeeParams, EventIdParam, EventsQuery, RenameEventAsset, ReorderEventAssets, UpdateEvent } from "../../schemas/events.js";
|
|
3
|
+
import "../../schemas/index.js";
|
|
4
|
+
import { defineTool } from "../tool.js";
|
|
5
|
+
//#region src/http/mcp/tools/events.ts
|
|
6
|
+
const eventTools = [
|
|
7
|
+
defineTool({
|
|
8
|
+
name: "list_events",
|
|
9
|
+
title: "List events",
|
|
10
|
+
description: "Search and page through events: live sessions at a set time, drafts and canceled ones included. Filter by status, or by a from and to date-time range the event overlaps.",
|
|
11
|
+
kind: "read",
|
|
12
|
+
idempotent: true,
|
|
13
|
+
openWorld: false,
|
|
14
|
+
input: EventsQuery,
|
|
15
|
+
call: (input, { container, caller }) => container.content.listEvents(input, caller.actor)
|
|
16
|
+
}),
|
|
17
|
+
defineTool({
|
|
18
|
+
name: "get_event",
|
|
19
|
+
title: "Get event",
|
|
20
|
+
description: "One event with its times, time zone, location, recording and settings: event type, capacity, notifications and replay.",
|
|
21
|
+
kind: "read",
|
|
22
|
+
idempotent: true,
|
|
23
|
+
openWorld: false,
|
|
24
|
+
input: EventIdParam,
|
|
25
|
+
call: ({ eventId }, { container, caller }) => container.content.getEvent(eventId, caller.actor)
|
|
26
|
+
}),
|
|
27
|
+
defineTool({
|
|
28
|
+
name: "create_event",
|
|
29
|
+
title: "Create event",
|
|
30
|
+
description: "Create a draft event. startsAt and endsAt are date-times, timeZone an IANA name. Publish it with update_event.",
|
|
31
|
+
kind: "write",
|
|
32
|
+
idempotent: false,
|
|
33
|
+
openWorld: false,
|
|
34
|
+
input: CreateEvent,
|
|
35
|
+
call: (input, { container, caller }) => container.content.createEvent(input, caller.actor)
|
|
36
|
+
}),
|
|
37
|
+
defineTool({
|
|
38
|
+
name: "update_event",
|
|
39
|
+
title: "Update event",
|
|
40
|
+
description: "Change an event title, description, times, location, cover image, recording or settings, or publish and unpublish it with status. Fields left out stay as they are. A canceled event cannot change.",
|
|
41
|
+
kind: "write",
|
|
42
|
+
idempotent: true,
|
|
43
|
+
openWorld: false,
|
|
44
|
+
input: UpdateEvent.extend(EventIdParam.shape),
|
|
45
|
+
call: ({ eventId, ...patch }, { container, caller }) => container.content.updateEvent(eventId, patch, caller.actor)
|
|
46
|
+
}),
|
|
47
|
+
defineTool({
|
|
48
|
+
name: "cancel_event",
|
|
49
|
+
title: "Cancel event",
|
|
50
|
+
description: "Cancel an event and tell its attendees. Canceling is final.",
|
|
51
|
+
kind: "destructive",
|
|
52
|
+
idempotent: false,
|
|
53
|
+
openWorld: false,
|
|
54
|
+
input: EventIdParam,
|
|
55
|
+
call: ({ eventId }, { container, caller }) => container.content.cancelEvent(eventId, caller.actor)
|
|
56
|
+
}),
|
|
57
|
+
defineTool({
|
|
58
|
+
name: "delete_event",
|
|
59
|
+
title: "Delete event",
|
|
60
|
+
description: "Permanently delete an event. The uploaded files are kept.",
|
|
61
|
+
kind: "destructive",
|
|
62
|
+
idempotent: true,
|
|
63
|
+
openWorld: false,
|
|
64
|
+
input: EventIdParam,
|
|
65
|
+
call: ({ eventId }, { container, caller }) => container.content.deleteEvent(eventId, caller.actor)
|
|
66
|
+
}),
|
|
67
|
+
defineTool({
|
|
68
|
+
name: "list_event_attendees",
|
|
69
|
+
title: "List event attendees",
|
|
70
|
+
description: "The people attending an event, directly or through a bundle, by grant date, each with how they got their place: self, manual, automation or bundle.",
|
|
71
|
+
kind: "read",
|
|
72
|
+
idempotent: true,
|
|
73
|
+
openWorld: false,
|
|
74
|
+
input: PageQuery.extend(EventIdParam.shape),
|
|
75
|
+
call: ({ eventId, ...page }, { container, caller }) => container.reporting.admin.eventAttendees(eventId, page, caller.actor)
|
|
76
|
+
}),
|
|
77
|
+
defineTool({
|
|
78
|
+
name: "get_event_analytics",
|
|
79
|
+
title: "Get event analytics",
|
|
80
|
+
description: "Attendance figures for one event: attendees now and by source, capacity, revoked grants, and grants over time before the start.",
|
|
81
|
+
kind: "read",
|
|
82
|
+
idempotent: true,
|
|
83
|
+
openWorld: false,
|
|
84
|
+
input: EventIdParam,
|
|
85
|
+
call: ({ eventId }, { container, caller }) => container.reporting.admin.eventAnalytics(eventId, caller.actor)
|
|
86
|
+
}),
|
|
87
|
+
defineTool({
|
|
88
|
+
name: "add_event_attendee",
|
|
89
|
+
title: "Add event attendee",
|
|
90
|
+
description: "Grant an event to a person (orgUserId) so they attend it. The event must be published, not ended and not full. Adding someone who already attends changes nothing.",
|
|
91
|
+
kind: "write",
|
|
92
|
+
idempotent: true,
|
|
93
|
+
openWorld: false,
|
|
94
|
+
input: AddEventAttendee.extend(EventIdParam.shape),
|
|
95
|
+
call: ({ eventId, orgUserId }, { container, caller }) => container.entitlements.grant({
|
|
96
|
+
orgUserId,
|
|
97
|
+
contentId: eventId,
|
|
98
|
+
contentType: "event",
|
|
99
|
+
expiresAt: null
|
|
100
|
+
}, caller.actor)
|
|
101
|
+
}),
|
|
102
|
+
defineTool({
|
|
103
|
+
name: "remove_event_attendee",
|
|
104
|
+
title: "Remove event attendee",
|
|
105
|
+
description: "Revoke a person's direct grant to an event. Someone who attends only through a bundle keeps attending.",
|
|
106
|
+
kind: "destructive",
|
|
107
|
+
idempotent: false,
|
|
108
|
+
openWorld: false,
|
|
109
|
+
input: EventAttendeeParams,
|
|
110
|
+
call: ({ eventId, orgUserId }, { container, caller }) => container.entitlements.revoke({
|
|
111
|
+
orgUserId,
|
|
112
|
+
contentId: eventId,
|
|
113
|
+
contentType: "event"
|
|
114
|
+
}, caller.actor)
|
|
115
|
+
}),
|
|
116
|
+
defineTool({
|
|
117
|
+
name: "list_event_files",
|
|
118
|
+
title: "List event files",
|
|
119
|
+
description: "The files attached to an event, in order, with their display names.",
|
|
120
|
+
kind: "read",
|
|
121
|
+
idempotent: true,
|
|
122
|
+
openWorld: false,
|
|
123
|
+
input: EventIdParam,
|
|
124
|
+
call: ({ eventId }, { container, caller }) => container.content.listEventAssets(eventId, caller.actor)
|
|
125
|
+
}),
|
|
126
|
+
defineTool({
|
|
127
|
+
name: "add_event_file",
|
|
128
|
+
title: "Add file to event",
|
|
129
|
+
description: "Attach an uploaded file to the end of an event. Find file ids with list_media.",
|
|
130
|
+
kind: "write",
|
|
131
|
+
idempotent: false,
|
|
132
|
+
openWorld: false,
|
|
133
|
+
input: AddEventAsset.extend(EventIdParam.shape),
|
|
134
|
+
call: ({ eventId, ...file }, { container, caller }) => container.content.addEventAsset(eventId, file, caller.actor)
|
|
135
|
+
}),
|
|
136
|
+
defineTool({
|
|
137
|
+
name: "rename_event_file",
|
|
138
|
+
title: "Rename event file",
|
|
139
|
+
description: "Set the name a file shows under in an event. null shows the file name.",
|
|
140
|
+
kind: "write",
|
|
141
|
+
idempotent: true,
|
|
142
|
+
openWorld: false,
|
|
143
|
+
input: RenameEventAsset.extend(EventAssetParams.shape),
|
|
144
|
+
call: ({ eventId, assetId, displayName }, { container, caller }) => container.content.renameEventAsset(eventId, assetId, displayName, caller.actor)
|
|
145
|
+
}),
|
|
146
|
+
defineTool({
|
|
147
|
+
name: "reorder_event_files",
|
|
148
|
+
title: "Reorder event files",
|
|
149
|
+
description: "Set the file order of an event. Pass every file id attached to the event in the new order.",
|
|
150
|
+
kind: "write",
|
|
151
|
+
idempotent: true,
|
|
152
|
+
openWorld: false,
|
|
153
|
+
input: ReorderEventAssets.extend(EventIdParam.shape),
|
|
154
|
+
call: ({ eventId, assetIds }, { container, caller }) => container.content.reorderEventAssets(eventId, assetIds, caller.actor)
|
|
155
|
+
}),
|
|
156
|
+
defineTool({
|
|
157
|
+
name: "remove_event_file",
|
|
158
|
+
title: "Remove file from event",
|
|
159
|
+
description: "Take a file off an event. The uploaded file itself is kept.",
|
|
160
|
+
kind: "destructive",
|
|
161
|
+
idempotent: true,
|
|
162
|
+
openWorld: false,
|
|
163
|
+
input: EventAssetParams,
|
|
164
|
+
call: ({ eventId, assetId }, { container, caller }) => container.content.removeEventAsset(eventId, assetId, caller.actor)
|
|
165
|
+
})
|
|
166
|
+
];
|
|
167
|
+
//#endregion
|
|
168
|
+
export { eventTools };
|
|
169
|
+
|
|
170
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../../../../src/http/mcp/tools/events.ts"],"sourcesContent":["import {\n AddEventAsset,\n AddEventAttendee,\n CreateEvent,\n EventAssetParams,\n EventAttendeeParams,\n EventIdParam,\n EventsQuery,\n PageQuery,\n RenameEventAsset,\n ReorderEventAssets,\n UpdateEvent,\n} from '../../schemas/index.js';\nimport { defineTool, type Tool } from '../tool.js';\n\nexport const eventTools: Tool[] = [\n defineTool({\n name: 'list_events',\n title: 'List events',\n description:\n 'Search and page through events: live sessions at a set time, drafts and canceled ones included. Filter by status, or by a from and to date-time range the event overlaps.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: EventsQuery,\n call: (input, { container, caller }) => container.content.listEvents(input, caller.actor),\n }),\n defineTool({\n name: 'get_event',\n title: 'Get event',\n description:\n 'One event with its times, time zone, location, recording and settings: event type, capacity, notifications and replay.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: EventIdParam,\n call: ({ eventId }, { container, caller }) => container.content.getEvent(eventId, caller.actor),\n }),\n defineTool({\n name: 'create_event',\n title: 'Create event',\n description:\n 'Create a draft event. startsAt and endsAt are date-times, timeZone an IANA name. Publish it with update_event.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateEvent,\n call: (input, { container, caller }) => container.content.createEvent(input, caller.actor),\n }),\n defineTool({\n name: 'update_event',\n title: 'Update event',\n description:\n 'Change an event title, description, times, location, cover image, recording or settings, or publish and unpublish it with status. Fields left out stay as they are. A canceled event cannot change.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateEvent.extend(EventIdParam.shape),\n call: ({ eventId, ...patch }, { container, caller }) =>\n container.content.updateEvent(eventId, patch, caller.actor),\n }),\n defineTool({\n name: 'cancel_event',\n title: 'Cancel event',\n description: 'Cancel an event and tell its attendees. Canceling is final.',\n kind: 'destructive',\n idempotent: false,\n openWorld: false,\n input: EventIdParam,\n call: ({ eventId }, { container, caller }) =>\n container.content.cancelEvent(eventId, caller.actor),\n }),\n defineTool({\n name: 'delete_event',\n title: 'Delete event',\n description: 'Permanently delete an event. The uploaded files are kept.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: EventIdParam,\n call: ({ eventId }, { container, caller }) =>\n container.content.deleteEvent(eventId, caller.actor),\n }),\n defineTool({\n name: 'list_event_attendees',\n title: 'List event attendees',\n description:\n 'The people attending an event, directly or through a bundle, by grant date, each with how they got their place: self, manual, automation or bundle.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: PageQuery.extend(EventIdParam.shape),\n call: ({ eventId, ...page }, { container, caller }) =>\n container.reporting.admin.eventAttendees(eventId, page, caller.actor),\n }),\n defineTool({\n name: 'get_event_analytics',\n title: 'Get event analytics',\n description:\n 'Attendance figures for one event: attendees now and by source, capacity, revoked grants, and grants over time before the start.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: EventIdParam,\n call: ({ eventId }, { container, caller }) =>\n container.reporting.admin.eventAnalytics(eventId, caller.actor),\n }),\n defineTool({\n name: 'add_event_attendee',\n title: 'Add event attendee',\n description:\n 'Grant an event to a person (orgUserId) so they attend it. The event must be published, not ended and not full. Adding someone who already attends changes nothing.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: AddEventAttendee.extend(EventIdParam.shape),\n call: ({ eventId, orgUserId }, { container, caller }) =>\n container.entitlements.grant(\n { orgUserId, contentId: eventId, contentType: 'event', expiresAt: null },\n caller.actor,\n ),\n }),\n defineTool({\n name: 'remove_event_attendee',\n title: 'Remove event attendee',\n description:\n \"Revoke a person's direct grant to an event. Someone who attends only through a bundle keeps attending.\",\n kind: 'destructive',\n idempotent: false,\n openWorld: false,\n input: EventAttendeeParams,\n call: ({ eventId, orgUserId }, { container, caller }) =>\n container.entitlements.revoke(\n { orgUserId, contentId: eventId, contentType: 'event' },\n caller.actor,\n ),\n }),\n defineTool({\n name: 'list_event_files',\n title: 'List event files',\n description: 'The files attached to an event, in order, with their display names.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: EventIdParam,\n call: ({ eventId }, { container, caller }) =>\n container.content.listEventAssets(eventId, caller.actor),\n }),\n defineTool({\n name: 'add_event_file',\n title: 'Add file to event',\n description: 'Attach an uploaded file to the end of an event. Find file ids with list_media.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: AddEventAsset.extend(EventIdParam.shape),\n call: ({ eventId, ...file }, { container, caller }) =>\n container.content.addEventAsset(eventId, file, caller.actor),\n }),\n defineTool({\n name: 'rename_event_file',\n title: 'Rename event file',\n description: 'Set the name a file shows under in an event. null shows the file name.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: RenameEventAsset.extend(EventAssetParams.shape),\n call: ({ eventId, assetId, displayName }, { container, caller }) =>\n container.content.renameEventAsset(eventId, assetId, displayName, caller.actor),\n }),\n defineTool({\n name: 'reorder_event_files',\n title: 'Reorder event files',\n description:\n 'Set the file order of an event. Pass every file id attached to the event in the new order.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ReorderEventAssets.extend(EventIdParam.shape),\n call: ({ eventId, assetIds }, { container, caller }) =>\n container.content.reorderEventAssets(eventId, assetIds, caller.actor),\n }),\n defineTool({\n name: 'remove_event_file',\n title: 'Remove file from event',\n description: 'Take a file off an event. The uploaded file itself is kept.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: EventAssetParams,\n call: ({ eventId, assetId }, { container, caller }) =>\n container.content.removeEventAsset(eventId, assetId, caller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AAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,iBAAiB,OAAO,iBAAiB,KAAK;EACrD,OAAO,EAAE,SAAS,SAAS,eAAe,EAAE,WAAW,aACrD,UAAU,QAAQ,iBAAiB,SAAS,SAAS,aAAa,OAAO,KAAK;CAClF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,mBAAmB,OAAO,aAAa,KAAK;EACnD,OAAO,EAAE,SAAS,YAAY,EAAE,WAAW,aACzC,UAAU,QAAQ,mBAAmB,SAAS,UAAU,OAAO,KAAK;CACxE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,SAAS,WAAW,EAAE,WAAW,aACxC,UAAU,QAAQ,iBAAiB,SAAS,SAAS,OAAO,KAAK;CACrE,CAAC;AACH"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Tool } from "../tool.js";
|
|
2
2
|
//#region src/http/mcp/tools/index.d.ts
|
|
3
|
+
declare const TOOL_GROUPS: {
|
|
4
|
+
title: string;
|
|
5
|
+
tools: Tool[];
|
|
6
|
+
}[];
|
|
3
7
|
declare const TOOLS: Tool[];
|
|
4
8
|
//#endregion
|
|
5
|
-
export { TOOLS };
|
|
9
|
+
export { TOOLS, TOOL_GROUPS };
|
|
6
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,19 +5,54 @@ import { communityMemberTools } from "./community-members.js";
|
|
|
5
5
|
import { communityModerationTools } from "./community-moderation.js";
|
|
6
6
|
import { communityTools } from "./communities.js";
|
|
7
7
|
import { courseTools } from "./courses.js";
|
|
8
|
+
import { eventTools } from "./events.js";
|
|
8
9
|
import { peopleTools } from "./people.js";
|
|
10
|
+
import { organizationTools } from "./organization.js";
|
|
9
11
|
//#region src/http/mcp/tools/index.ts
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const TOOL_GROUPS = [
|
|
13
|
+
{
|
|
14
|
+
title: "Courses",
|
|
15
|
+
tools: courseTools
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: "Downloads, bundles and media",
|
|
19
|
+
tools: catalogTools
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
title: "Events",
|
|
23
|
+
tools: eventTools
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: "Students, access and analytics",
|
|
27
|
+
tools: peopleTools
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: "Organization, roles and team",
|
|
31
|
+
tools: organizationTools
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: "Workflows and webhooks",
|
|
35
|
+
tools: automationTools
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: "Comments",
|
|
39
|
+
tools: commentTools
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: "Communities",
|
|
43
|
+
tools: communityTools
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: "Community members",
|
|
47
|
+
tools: communityMemberTools
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "Community moderation",
|
|
51
|
+
tools: communityModerationTools
|
|
52
|
+
}
|
|
19
53
|
];
|
|
54
|
+
const TOOLS = TOOL_GROUPS.flatMap((group) => group.tools);
|
|
20
55
|
//#endregion
|
|
21
|
-
export { TOOLS };
|
|
56
|
+
export { TOOLS, TOOL_GROUPS };
|
|
22
57
|
|
|
23
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/http/mcp/tools/index.ts"],"sourcesContent":["import type { Tool } from '../tool.js';\nimport { automationTools } from './automations.js';\nimport { catalogTools } from './catalog.js';\nimport { commentTools } from './comments.js';\nimport { communityMemberTools } from './community-members.js';\nimport { communityModerationTools } from './community-moderation.js';\nimport { communityTools } from './communities.js';\nimport { courseTools } from './courses.js';\nimport { peopleTools } from './people.js';\n\nexport const
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/http/mcp/tools/index.ts"],"sourcesContent":["import type { Tool } from '../tool.js';\nimport { automationTools } from './automations.js';\nimport { catalogTools } from './catalog.js';\nimport { commentTools } from './comments.js';\nimport { communityMemberTools } from './community-members.js';\nimport { communityModerationTools } from './community-moderation.js';\nimport { communityTools } from './communities.js';\nimport { courseTools } from './courses.js';\nimport { eventTools } from './events.js';\nimport { peopleTools } from './people.js';\nimport { organizationTools } from './organization.js';\n\nexport const TOOL_GROUPS: { title: string; tools: Tool[] }[] = [\n { title: 'Courses', tools: courseTools },\n { title: 'Downloads, bundles and media', tools: catalogTools },\n { title: 'Events', tools: eventTools },\n { title: 'Students, access and analytics', tools: peopleTools },\n { title: 'Organization, roles and team', tools: organizationTools },\n { title: 'Workflows and webhooks', tools: automationTools },\n { title: 'Comments', tools: commentTools },\n { title: 'Communities', tools: communityTools },\n { title: 'Community members', tools: communityMemberTools },\n { title: 'Community moderation', tools: communityModerationTools },\n];\n\nexport const TOOLS: Tool[] = TOOL_GROUPS.flatMap((group) => group.tools);\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,cAAkD;CAC7D;EAAE,OAAO;EAAW,OAAO;CAAY;CACvC;EAAE,OAAO;EAAgC,OAAO;CAAa;CAC7D;EAAE,OAAO;EAAU,OAAO;CAAW;CACrC;EAAE,OAAO;EAAkC,OAAO;CAAY;CAC9D;EAAE,OAAO;EAAgC,OAAO;CAAkB;CAClE;EAAE,OAAO;EAA0B,OAAO;CAAgB;CAC1D;EAAE,OAAO;EAAY,OAAO;CAAa;CACzC;EAAE,OAAO;EAAe,OAAO;CAAe;CAC9C;EAAE,OAAO;EAAqB,OAAO;CAAqB;CAC1D;EAAE,OAAO;EAAwB,OAAO;CAAyB;AACnE;AAEA,MAAa,QAAgB,YAAY,SAAS,UAAU,MAAM,KAAK"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { AssignmentList, ContentIdParam, CreateRole, MembersPage, MembersQuery, OrgRoleList, OrgRoleView, OrgUserContentParam, OrgUserIdParam, RoleKeyParam, SetRole, UpdateRole } from "../../schemas/members.js";
|
|
2
|
+
import { Organization, UpdateOrganization } from "../../schemas/organizations.js";
|
|
3
|
+
import { CreateInvite, Invite } from "../../schemas/invites.js";
|
|
4
|
+
import "../../schemas/index.js";
|
|
5
|
+
import { defineTool, noInput } from "../tool.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
//#region src/http/mcp/tools/organization.ts
|
|
8
|
+
const organizationTools = [
|
|
9
|
+
defineTool({
|
|
10
|
+
name: "update_organization",
|
|
11
|
+
title: "Update organization",
|
|
12
|
+
description: "Change the organization's name or slug.",
|
|
13
|
+
kind: "write",
|
|
14
|
+
idempotent: true,
|
|
15
|
+
openWorld: false,
|
|
16
|
+
input: UpdateOrganization,
|
|
17
|
+
output: Organization,
|
|
18
|
+
call: async (input, { container, caller }) => {
|
|
19
|
+
const org = await container.organizations.updateOrganization(input, caller.actor);
|
|
20
|
+
return {
|
|
21
|
+
id: org.id,
|
|
22
|
+
name: org.name,
|
|
23
|
+
slug: org.slug,
|
|
24
|
+
createdAt: org.createdAt.toISOString()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
defineTool({
|
|
29
|
+
name: "list_roles",
|
|
30
|
+
title: "List roles",
|
|
31
|
+
description: "The organization's roles with their levels, permissions and how many people hold each.",
|
|
32
|
+
kind: "read",
|
|
33
|
+
idempotent: true,
|
|
34
|
+
openWorld: false,
|
|
35
|
+
input: noInput,
|
|
36
|
+
output: z.object({ roles: OrgRoleList }),
|
|
37
|
+
call: async (_input, { container, caller }) => ({ roles: await container.organizations.listRoles(caller.actor) })
|
|
38
|
+
}),
|
|
39
|
+
defineTool({
|
|
40
|
+
name: "get_role",
|
|
41
|
+
title: "Get role",
|
|
42
|
+
description: "One role with its levels and permissions.",
|
|
43
|
+
kind: "read",
|
|
44
|
+
idempotent: true,
|
|
45
|
+
openWorld: false,
|
|
46
|
+
input: RoleKeyParam,
|
|
47
|
+
output: OrgRoleView,
|
|
48
|
+
call: ({ key }, { container, caller }) => container.organizations.getRole(key, caller.actor)
|
|
49
|
+
}),
|
|
50
|
+
defineTool({
|
|
51
|
+
name: "update_role",
|
|
52
|
+
title: "Update role",
|
|
53
|
+
description: "Rename a role, or change its permissions, levels or team flag. Changes need every permission the role holds before and after.",
|
|
54
|
+
kind: "write",
|
|
55
|
+
idempotent: true,
|
|
56
|
+
openWorld: false,
|
|
57
|
+
input: UpdateRole.extend(RoleKeyParam.shape),
|
|
58
|
+
output: OrgRoleView,
|
|
59
|
+
call: ({ key, ...input }, { container, caller }) => container.organizations.updateRole(key, input, caller.actor)
|
|
60
|
+
}),
|
|
61
|
+
defineTool({
|
|
62
|
+
name: "create_role",
|
|
63
|
+
title: "Create role",
|
|
64
|
+
description: "Add a role to the organization, starting from a deployment role (base).",
|
|
65
|
+
kind: "write",
|
|
66
|
+
idempotent: false,
|
|
67
|
+
openWorld: false,
|
|
68
|
+
input: CreateRole,
|
|
69
|
+
output: OrgRoleView,
|
|
70
|
+
call: (input, { container, caller }) => container.organizations.createRole(input, caller.actor)
|
|
71
|
+
}),
|
|
72
|
+
defineTool({
|
|
73
|
+
name: "reset_role",
|
|
74
|
+
title: "Reset role",
|
|
75
|
+
description: "Reset a deployment role to the deployment's version.",
|
|
76
|
+
kind: "destructive",
|
|
77
|
+
idempotent: true,
|
|
78
|
+
openWorld: false,
|
|
79
|
+
input: RoleKeyParam,
|
|
80
|
+
output: OrgRoleView,
|
|
81
|
+
call: ({ key }, { container, caller }) => container.organizations.resetRole(key, caller.actor)
|
|
82
|
+
}),
|
|
83
|
+
defineTool({
|
|
84
|
+
name: "delete_role",
|
|
85
|
+
title: "Delete role",
|
|
86
|
+
description: "Delete a role the organization added. Refused while anyone holds it.",
|
|
87
|
+
kind: "destructive",
|
|
88
|
+
idempotent: false,
|
|
89
|
+
openWorld: false,
|
|
90
|
+
input: RoleKeyParam,
|
|
91
|
+
call: ({ key }, { container, caller }) => container.organizations.deleteRole(key, caller.actor)
|
|
92
|
+
}),
|
|
93
|
+
defineTool({
|
|
94
|
+
name: "list_team",
|
|
95
|
+
title: "List team",
|
|
96
|
+
description: "Everyone with an org role other than Member or a role on a content item, invited people included.",
|
|
97
|
+
kind: "read",
|
|
98
|
+
idempotent: true,
|
|
99
|
+
openWorld: false,
|
|
100
|
+
input: MembersQuery,
|
|
101
|
+
output: MembersPage,
|
|
102
|
+
call: (input, { container, caller }) => container.organizations.listTeam(input, caller.actor)
|
|
103
|
+
}),
|
|
104
|
+
defineTool({
|
|
105
|
+
name: "list_person_roles",
|
|
106
|
+
title: "List a person's roles",
|
|
107
|
+
description: "A person's org role and every role they hold on a content item.",
|
|
108
|
+
kind: "read",
|
|
109
|
+
idempotent: true,
|
|
110
|
+
openWorld: false,
|
|
111
|
+
input: OrgUserIdParam,
|
|
112
|
+
output: z.object({ roles: AssignmentList }),
|
|
113
|
+
call: async ({ orgUserId }, { container, caller }) => ({ roles: await container.organizations.listAssignments(orgUserId, caller.actor) })
|
|
114
|
+
}),
|
|
115
|
+
defineTool({
|
|
116
|
+
name: "list_roles_on_content",
|
|
117
|
+
title: "List roles on content",
|
|
118
|
+
description: "The people with a role on one course, download, community or event.",
|
|
119
|
+
kind: "read",
|
|
120
|
+
idempotent: true,
|
|
121
|
+
openWorld: false,
|
|
122
|
+
input: ContentIdParam,
|
|
123
|
+
output: z.object({ roles: AssignmentList }),
|
|
124
|
+
call: async ({ contentId }, { container, caller }) => ({ roles: await container.organizations.listAssignmentsOn(contentId, caller.actor) })
|
|
125
|
+
}),
|
|
126
|
+
defineTool({
|
|
127
|
+
name: "set_org_role",
|
|
128
|
+
title: "Set org role",
|
|
129
|
+
description: "Set a person's org role. Needs every permission the old and the new role hold.",
|
|
130
|
+
kind: "write",
|
|
131
|
+
idempotent: true,
|
|
132
|
+
openWorld: false,
|
|
133
|
+
input: SetRole.extend(OrgUserIdParam.shape),
|
|
134
|
+
output: z.object({ roles: AssignmentList }),
|
|
135
|
+
call: async ({ orgUserId, roleKey }, { container, caller }) => ({ roles: await container.organizations.setOrgRole(orgUserId, roleKey, caller.actor) })
|
|
136
|
+
}),
|
|
137
|
+
defineTool({
|
|
138
|
+
name: "assign_role",
|
|
139
|
+
title: "Give a role on content",
|
|
140
|
+
description: "Give a person a role on one course, download, community or event. The role must list the item's type.",
|
|
141
|
+
kind: "write",
|
|
142
|
+
idempotent: true,
|
|
143
|
+
openWorld: false,
|
|
144
|
+
input: SetRole.extend(OrgUserContentParam.shape),
|
|
145
|
+
output: z.object({ roles: AssignmentList }),
|
|
146
|
+
call: async ({ orgUserId, contentId, roleKey }, { container, caller }) => ({ roles: await container.organizations.assignRole(orgUserId, contentId, roleKey, caller.actor) })
|
|
147
|
+
}),
|
|
148
|
+
defineTool({
|
|
149
|
+
name: "unassign_role",
|
|
150
|
+
title: "Remove a role on content",
|
|
151
|
+
description: "Remove a person's role on one course, download, community or event.",
|
|
152
|
+
kind: "destructive",
|
|
153
|
+
idempotent: true,
|
|
154
|
+
openWorld: false,
|
|
155
|
+
input: OrgUserContentParam,
|
|
156
|
+
output: z.object({ roles: AssignmentList }),
|
|
157
|
+
call: async ({ orgUserId, contentId }, { container, caller }) => ({ roles: await container.organizations.unassignRole(orgUserId, contentId, caller.actor) })
|
|
158
|
+
}),
|
|
159
|
+
defineTool({
|
|
160
|
+
name: "invite_person",
|
|
161
|
+
title: "Invite person",
|
|
162
|
+
description: "Invite someone by email with an org role (default member). They exist as an invited person at once.",
|
|
163
|
+
kind: "write",
|
|
164
|
+
idempotent: false,
|
|
165
|
+
openWorld: true,
|
|
166
|
+
input: CreateInvite,
|
|
167
|
+
output: Invite,
|
|
168
|
+
call: async (input, { container, caller }) => {
|
|
169
|
+
const invite = await container.organizations.createInvite(input, caller.actor, caller.userId);
|
|
170
|
+
return {
|
|
171
|
+
id: invite.id,
|
|
172
|
+
email: invite.email,
|
|
173
|
+
roleKey: invite.roleKey,
|
|
174
|
+
status: invite.status,
|
|
175
|
+
expiresAt: invite.expiresAt,
|
|
176
|
+
createdAt: invite.createdAt
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}),
|
|
180
|
+
defineTool({
|
|
181
|
+
name: "resend_invite",
|
|
182
|
+
title: "Resend invite",
|
|
183
|
+
description: "Send a person's pending invite email again, with a new link.",
|
|
184
|
+
kind: "write",
|
|
185
|
+
idempotent: false,
|
|
186
|
+
openWorld: true,
|
|
187
|
+
input: OrgUserIdParam,
|
|
188
|
+
call: ({ orgUserId }, { container, caller }) => container.organizations.resendInvite(orgUserId, caller.actor, caller.userId)
|
|
189
|
+
}),
|
|
190
|
+
defineTool({
|
|
191
|
+
name: "cancel_invite",
|
|
192
|
+
title: "Cancel invite",
|
|
193
|
+
description: "Cancel a person's pending invite.",
|
|
194
|
+
kind: "destructive",
|
|
195
|
+
idempotent: false,
|
|
196
|
+
openWorld: false,
|
|
197
|
+
input: OrgUserIdParam,
|
|
198
|
+
call: ({ orgUserId }, { container, caller }) => container.organizations.cancelInvite(orgUserId, caller.actor)
|
|
199
|
+
}),
|
|
200
|
+
defineTool({
|
|
201
|
+
name: "remove_person",
|
|
202
|
+
title: "Remove person",
|
|
203
|
+
description: "Remove a person from the organization, with their API keys and connected apps here. Needs every permission they hold.",
|
|
204
|
+
kind: "destructive",
|
|
205
|
+
idempotent: false,
|
|
206
|
+
openWorld: false,
|
|
207
|
+
input: OrgUserIdParam,
|
|
208
|
+
call: ({ orgUserId }, { container, caller }) => container.organizations.removePerson(orgUserId, caller.actor)
|
|
209
|
+
})
|
|
210
|
+
];
|
|
211
|
+
//#endregion
|
|
212
|
+
export { organizationTools };
|
|
213
|
+
|
|
214
|
+
//# sourceMappingURL=organization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.js","names":[],"sources":["../../../../src/http/mcp/tools/organization.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n AssignmentList,\n ContentIdParam,\n CreateInvite,\n CreateRole,\n Invite,\n MembersPage,\n MembersQuery,\n OrgRoleList,\n OrgRoleView,\n OrgUserContentParam,\n OrgUserIdParam,\n Organization,\n RoleKeyParam,\n SetRole,\n UpdateOrganization,\n UpdateRole,\n} from '../../schemas/index.js';\nimport { defineTool, noInput, type Tool } from '../tool.js';\n\nexport const organizationTools: Tool[] = [\n defineTool({\n name: 'update_organization',\n title: 'Update organization',\n description: \"Change the organization's name or slug.\",\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateOrganization,\n output: Organization,\n call: async (input, { container, caller }) => {\n const org = await container.organizations.updateOrganization(input, caller.actor);\n return { id: org.id, name: org.name, slug: org.slug, createdAt: org.createdAt.toISOString() };\n },\n }),\n defineTool({\n name: 'list_roles',\n title: 'List roles',\n description:\n \"The organization's roles with their levels, permissions and how many people hold each.\",\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: noInput,\n output: z.object({ roles: OrgRoleList }),\n call: async (_input, { container, caller }) => ({\n roles: await container.organizations.listRoles(caller.actor),\n }),\n }),\n defineTool({\n name: 'get_role',\n title: 'Get role',\n description: 'One role with its levels and permissions.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: RoleKeyParam,\n output: OrgRoleView,\n call: ({ key }, { container, caller }) => container.organizations.getRole(key, caller.actor),\n }),\n defineTool({\n name: 'update_role',\n title: 'Update role',\n description:\n 'Rename a role, or change its permissions, levels or team flag. Changes need every permission the role holds before and after.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateRole.extend(RoleKeyParam.shape),\n output: OrgRoleView,\n call: ({ key, ...input }, { container, caller }) =>\n container.organizations.updateRole(key, input, caller.actor),\n }),\n defineTool({\n name: 'create_role',\n title: 'Create role',\n description: 'Add a role to the organization, starting from a deployment role (base).',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateRole,\n output: OrgRoleView,\n call: (input, { container, caller }) => container.organizations.createRole(input, caller.actor),\n }),\n defineTool({\n name: 'reset_role',\n title: 'Reset role',\n description: \"Reset a deployment role to the deployment's version.\",\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: RoleKeyParam,\n output: OrgRoleView,\n call: ({ key }, { container, caller }) => container.organizations.resetRole(key, caller.actor),\n }),\n defineTool({\n name: 'delete_role',\n title: 'Delete role',\n description: 'Delete a role the organization added. Refused while anyone holds it.',\n kind: 'destructive',\n idempotent: false,\n openWorld: false,\n input: RoleKeyParam,\n call: ({ key }, { container, caller }) => container.organizations.deleteRole(key, caller.actor),\n }),\n defineTool({\n name: 'list_team',\n title: 'List team',\n description:\n 'Everyone with an org role other than Member or a role on a content item, invited people included.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: MembersQuery,\n output: MembersPage,\n call: (input, { container, caller }) => container.organizations.listTeam(input, caller.actor),\n }),\n defineTool({\n name: 'list_person_roles',\n title: \"List a person's roles\",\n description: \"A person's org role and every role they hold on a content item.\",\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: OrgUserIdParam,\n output: z.object({ roles: AssignmentList }),\n call: async ({ orgUserId }, { container, caller }) => ({\n roles: await container.organizations.listAssignments(orgUserId, caller.actor),\n }),\n }),\n defineTool({\n name: 'list_roles_on_content',\n title: 'List roles on content',\n description: 'The people with a role on one course, download, community or event.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: ContentIdParam,\n output: z.object({ roles: AssignmentList }),\n call: async ({ contentId }, { container, caller }) => ({\n roles: await container.organizations.listAssignmentsOn(contentId, caller.actor),\n }),\n }),\n defineTool({\n name: 'set_org_role',\n title: 'Set org role',\n description: \"Set a person's org role. Needs every permission the old and the new role hold.\",\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: SetRole.extend(OrgUserIdParam.shape),\n output: z.object({ roles: AssignmentList }),\n call: async ({ orgUserId, roleKey }, { container, caller }) => ({\n roles: await container.organizations.setOrgRole(orgUserId, roleKey, caller.actor),\n }),\n }),\n defineTool({\n name: 'assign_role',\n title: 'Give a role on content',\n description:\n \"Give a person a role on one course, download, community or event. The role must list the item's type.\",\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: SetRole.extend(OrgUserContentParam.shape),\n output: z.object({ roles: AssignmentList }),\n call: async ({ orgUserId, contentId, roleKey }, { container, caller }) => ({\n roles: await container.organizations.assignRole(orgUserId, contentId, roleKey, caller.actor),\n }),\n }),\n defineTool({\n name: 'unassign_role',\n title: 'Remove a role on content',\n description: \"Remove a person's role on one course, download, community or event.\",\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: OrgUserContentParam,\n output: z.object({ roles: AssignmentList }),\n call: async ({ orgUserId, contentId }, { container, caller }) => ({\n roles: await container.organizations.unassignRole(orgUserId, contentId, caller.actor),\n }),\n }),\n defineTool({\n name: 'invite_person',\n title: 'Invite person',\n description:\n 'Invite someone by email with an org role (default member). They exist as an invited person at once.',\n kind: 'write',\n idempotent: false,\n openWorld: true,\n input: CreateInvite,\n output: Invite,\n call: async (input, { container, caller }) => {\n const invite = await container.organizations.createInvite(input, caller.actor, caller.userId);\n return {\n id: invite.id,\n email: invite.email,\n roleKey: invite.roleKey,\n status: invite.status,\n expiresAt: invite.expiresAt,\n createdAt: invite.createdAt,\n };\n },\n }),\n defineTool({\n name: 'resend_invite',\n title: 'Resend invite',\n description: \"Send a person's pending invite email again, with a new link.\",\n kind: 'write',\n idempotent: false,\n openWorld: true,\n input: OrgUserIdParam,\n call: ({ orgUserId }, { container, caller }) =>\n container.organizations.resendInvite(orgUserId, caller.actor, caller.userId),\n }),\n defineTool({\n name: 'cancel_invite',\n title: 'Cancel invite',\n description: \"Cancel a person's pending invite.\",\n kind: 'destructive',\n idempotent: false,\n openWorld: false,\n input: OrgUserIdParam,\n call: ({ orgUserId }, { container, caller }) =>\n container.organizations.cancelInvite(orgUserId, caller.actor),\n }),\n defineTool({\n name: 'remove_person',\n title: 'Remove person',\n description:\n 'Remove a person from the organization, with their API keys and connected apps here. Needs every permission they hold.',\n kind: 'destructive',\n idempotent: false,\n openWorld: false,\n input: OrgUserIdParam,\n call: ({ orgUserId }, { container, caller }) =>\n container.organizations.removePerson(orgUserId, caller.actor),\n }),\n];\n"],"mappings":";;;;;;;AAqBA,MAAa,oBAA4B;CACvC,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,QAAQ;EACR,MAAM,OAAO,OAAO,EAAE,WAAW,aAAa;GAC5C,MAAM,MAAM,MAAM,UAAU,cAAc,mBAAmB,OAAO,OAAO,KAAK;GAChF,OAAO;IAAE,IAAI,IAAI;IAAI,MAAM,IAAI;IAAM,MAAM,IAAI;IAAM,WAAW,IAAI,UAAU,YAAY;GAAE;EAC9F;CACF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,QAAQ,EAAE,OAAO,EAAE,OAAO,YAAY,CAAC;EACvC,MAAM,OAAO,QAAQ,EAAE,WAAW,cAAc,EAC9C,OAAO,MAAM,UAAU,cAAc,UAAU,OAAO,KAAK,EAC7D;CACF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,QAAQ;EACR,OAAO,EAAE,OAAO,EAAE,WAAW,aAAa,UAAU,cAAc,QAAQ,KAAK,OAAO,KAAK;CAC7F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,WAAW,OAAO,aAAa,KAAK;EAC3C,QAAQ;EACR,OAAO,EAAE,KAAK,GAAG,SAAS,EAAE,WAAW,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