@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.
Files changed (222) hide show
  1. package/README.md +14 -0
  2. package/dist/app/community-mail.d.ts +5 -3
  3. package/dist/app/community-mail.js +60 -12
  4. package/dist/app/community-mail.js.map +1 -1
  5. package/dist/app/container.d.ts +24 -3
  6. package/dist/app/container.js +102 -38
  7. package/dist/app/container.js.map +1 -1
  8. package/dist/app/notification-channels.js +1 -0
  9. package/dist/app/notification-channels.js.map +1 -1
  10. package/dist/app/notification-reads.d.ts +3 -3
  11. package/dist/app/notification-reads.js +7 -28
  12. package/dist/app/notification-reads.js.map +1 -1
  13. package/dist/app/platform.d.ts +14 -0
  14. package/dist/app/platform.js +14 -0
  15. package/dist/app/platform.js.map +1 -0
  16. package/dist/http/config.d.ts +4 -0
  17. package/dist/http/errors.js +9 -4
  18. package/dist/http/errors.js.map +1 -1
  19. package/dist/http/fastify.d.ts +8 -0
  20. package/dist/http/mcp/catalogue.d.ts +11 -9
  21. package/dist/http/mcp/catalogue.js +15 -21
  22. package/dist/http/mcp/catalogue.js.map +1 -1
  23. package/dist/http/mcp/challenge.js +3 -3
  24. package/dist/http/mcp/challenge.js.map +1 -1
  25. package/dist/http/mcp/route.js +7 -7
  26. package/dist/http/mcp/route.js.map +1 -1
  27. package/dist/http/mcp/test-support.d.ts +6 -5
  28. package/dist/http/mcp/test-support.js +32 -11
  29. package/dist/http/mcp/test-support.js.map +1 -1
  30. package/dist/http/mcp/tool.d.ts +3 -9
  31. package/dist/http/mcp/tool.js +14 -6
  32. package/dist/http/mcp/tool.js.map +1 -1
  33. package/dist/http/mcp/tools/automations.js +10 -20
  34. package/dist/http/mcp/tools/automations.js.map +1 -1
  35. package/dist/http/mcp/tools/catalog.js +25 -42
  36. package/dist/http/mcp/tools/catalog.js.map +1 -1
  37. package/dist/http/mcp/tools/comments.js +9 -19
  38. package/dist/http/mcp/tools/comments.js.map +1 -1
  39. package/dist/http/mcp/tools/communities.js +17 -32
  40. package/dist/http/mcp/tools/communities.js.map +1 -1
  41. package/dist/http/mcp/tools/community-members.js +9 -16
  42. package/dist/http/mcp/tools/community-members.js.map +1 -1
  43. package/dist/http/mcp/tools/community-moderation.js +13 -25
  44. package/dist/http/mcp/tools/community-moderation.js.map +1 -1
  45. package/dist/http/mcp/tools/courses.js +11 -21
  46. package/dist/http/mcp/tools/courses.js.map +1 -1
  47. package/dist/http/mcp/tools/events.d.ts +6 -0
  48. package/dist/http/mcp/tools/events.js +170 -0
  49. package/dist/http/mcp/tools/events.js.map +1 -0
  50. package/dist/http/mcp/tools/index.d.ts +5 -1
  51. package/dist/http/mcp/tools/index.js +45 -10
  52. package/dist/http/mcp/tools/index.js.map +1 -1
  53. package/dist/http/mcp/tools/organization.d.ts +6 -0
  54. package/dist/http/mcp/tools/organization.js +214 -0
  55. package/dist/http/mcp/tools/organization.js.map +1 -0
  56. package/dist/http/mcp/tools/people.js +30 -49
  57. package/dist/http/mcp/tools/people.js.map +1 -1
  58. package/dist/http/plugins/auth.js +37 -8
  59. package/dist/http/plugins/auth.js.map +1 -1
  60. package/dist/http/plugins/error-handler.d.ts +5 -1
  61. package/dist/http/plugins/error-handler.js +10 -2
  62. package/dist/http/plugins/error-handler.js.map +1 -1
  63. package/dist/http/plugins/openapi.js +18 -2
  64. package/dist/http/plugins/openapi.js.map +1 -1
  65. package/dist/http/plugins/platform.d.ts +7 -0
  66. package/dist/http/plugins/platform.js +13 -0
  67. package/dist/http/plugins/platform.js.map +1 -0
  68. package/dist/http/routes/access.js +54 -36
  69. package/dist/http/routes/access.js.map +1 -1
  70. package/dist/http/routes/activities.js +45 -45
  71. package/dist/http/routes/activities.js.map +1 -1
  72. package/dist/http/routes/assets.js +30 -65
  73. package/dist/http/routes/assets.js.map +1 -1
  74. package/dist/http/routes/automations.js +37 -42
  75. package/dist/http/routes/automations.js.map +1 -1
  76. package/dist/http/routes/bundles.js +33 -36
  77. package/dist/http/routes/bundles.js.map +1 -1
  78. package/dist/http/routes/communities.js +93 -145
  79. package/dist/http/routes/communities.js.map +1 -1
  80. package/dist/http/routes/community-moderation.js +83 -137
  81. package/dist/http/routes/community-moderation.js.map +1 -1
  82. package/dist/http/routes/course-analytics.js +32 -15
  83. package/dist/http/routes/course-analytics.js.map +1 -1
  84. package/dist/http/routes/courses.js +25 -32
  85. package/dist/http/routes/courses.js.map +1 -1
  86. package/dist/http/routes/dashboard.js +9 -9
  87. package/dist/http/routes/dashboard.js.map +1 -1
  88. package/dist/http/routes/discussion.js +21 -39
  89. package/dist/http/routes/discussion.js.map +1 -1
  90. package/dist/http/routes/downloads.js +41 -47
  91. package/dist/http/routes/downloads.js.map +1 -1
  92. package/dist/http/routes/entitlements.js +19 -23
  93. package/dist/http/routes/entitlements.js.map +1 -1
  94. package/dist/http/routes/events.d.ts +7 -0
  95. package/dist/http/routes/events.js +333 -0
  96. package/dist/http/routes/events.js.map +1 -0
  97. package/dist/http/routes/integrations.js +40 -73
  98. package/dist/http/routes/integrations.js.map +1 -1
  99. package/dist/http/routes/member/assets.js +10 -13
  100. package/dist/http/routes/member/assets.js.map +1 -1
  101. package/dist/http/routes/member/chats.js +170 -47
  102. package/dist/http/routes/member/chats.js.map +1 -1
  103. package/dist/http/routes/member/comments.js +65 -26
  104. package/dist/http/routes/member/comments.js.map +1 -1
  105. package/dist/http/routes/member/community.js +45 -52
  106. package/dist/http/routes/member/community.js.map +1 -1
  107. package/dist/http/routes/member/courses.js +12 -19
  108. package/dist/http/routes/member/courses.js.map +1 -1
  109. package/dist/http/routes/member/devices.js +9 -10
  110. package/dist/http/routes/member/devices.js.map +1 -1
  111. package/dist/http/routes/member/downloads.js +6 -9
  112. package/dist/http/routes/member/downloads.js.map +1 -1
  113. package/dist/http/routes/member/events.d.ts +7 -0
  114. package/dist/http/routes/member/events.js +386 -0
  115. package/dist/http/routes/member/events.js.map +1 -0
  116. package/dist/http/routes/member/files.js +88 -46
  117. package/dist/http/routes/member/files.js.map +1 -1
  118. package/dist/http/routes/member/index.js +2 -0
  119. package/dist/http/routes/member/index.js.map +1 -1
  120. package/dist/http/routes/member/notification-settings.js +15 -23
  121. package/dist/http/routes/member/notification-settings.js.map +1 -1
  122. package/dist/http/routes/member/notifications.js +16 -16
  123. package/dist/http/routes/member/notifications.js.map +1 -1
  124. package/dist/http/routes/member/org.js +5 -15
  125. package/dist/http/routes/member/org.js.map +1 -1
  126. package/dist/http/routes/member/posts.js +67 -68
  127. package/dist/http/routes/member/posts.js.map +1 -1
  128. package/dist/http/routes/member/profile.js +15 -6
  129. package/dist/http/routes/member/profile.js.map +1 -1
  130. package/dist/http/routes/member/progress.js +7 -11
  131. package/dist/http/routes/member/progress.js.map +1 -1
  132. package/dist/http/routes/organizations.js +319 -135
  133. package/dist/http/routes/organizations.js.map +1 -1
  134. package/dist/http/routes/platform.d.ts +7 -0
  135. package/dist/http/routes/platform.js +61 -0
  136. package/dist/http/routes/platform.js.map +1 -0
  137. package/dist/http/routes/students.js +12 -75
  138. package/dist/http/routes/students.js.map +1 -1
  139. package/dist/http/routes/webhooks.js +30 -39
  140. package/dist/http/routes/webhooks.js.map +1 -1
  141. package/dist/http/routes.js +9 -0
  142. package/dist/http/routes.js.map +1 -1
  143. package/dist/http/schemas/access.d.ts +346 -64
  144. package/dist/http/schemas/access.js +39 -12
  145. package/dist/http/schemas/access.js.map +1 -1
  146. package/dist/http/schemas/assets.d.ts +8 -3
  147. package/dist/http/schemas/assets.js +6 -5
  148. package/dist/http/schemas/assets.js.map +1 -1
  149. package/dist/http/schemas/automations.d.ts +4 -4
  150. package/dist/http/schemas/chats.d.ts +216 -37
  151. package/dist/http/schemas/chats.js +13 -4
  152. package/dist/http/schemas/chats.js.map +1 -1
  153. package/dist/http/schemas/community.d.ts +105 -31
  154. package/dist/http/schemas/community.js +25 -9
  155. package/dist/http/schemas/community.js.map +1 -1
  156. package/dist/http/schemas/course-analytics.d.ts +51 -1
  157. package/dist/http/schemas/course-analytics.js +19 -1
  158. package/dist/http/schemas/course-analytics.js.map +1 -1
  159. package/dist/http/schemas/dashboard.d.ts +1 -0
  160. package/dist/http/schemas/dashboard.js +2 -1
  161. package/dist/http/schemas/dashboard.js.map +1 -1
  162. package/dist/http/schemas/discussion.d.ts +22 -72
  163. package/dist/http/schemas/discussion.js +2 -2
  164. package/dist/http/schemas/discussion.js.map +1 -1
  165. package/dist/http/schemas/entitlements.d.ts +9 -12
  166. package/dist/http/schemas/entitlements.js +11 -5
  167. package/dist/http/schemas/entitlements.js.map +1 -1
  168. package/dist/http/schemas/events.d.ts +527 -0
  169. package/dist/http/schemas/events.js +64 -0
  170. package/dist/http/schemas/events.js.map +1 -0
  171. package/dist/http/schemas/files.d.ts +24 -5
  172. package/dist/http/schemas/files.js +15 -2
  173. package/dist/http/schemas/files.js.map +1 -1
  174. package/dist/http/schemas/index.d.ts +11 -9
  175. package/dist/http/schemas/index.js +11 -9
  176. package/dist/http/schemas/invites.d.ts +3 -47
  177. package/dist/http/schemas/invites.js +4 -25
  178. package/dist/http/schemas/invites.js.map +1 -1
  179. package/dist/http/schemas/member.d.ts +94 -7
  180. package/dist/http/schemas/member.js +7 -3
  181. package/dist/http/schemas/member.js.map +1 -1
  182. package/dist/http/schemas/members.d.ts +329 -65
  183. package/dist/http/schemas/members.js +67 -25
  184. package/dist/http/schemas/members.js.map +1 -1
  185. package/dist/http/schemas/notifications.d.ts +58 -54
  186. package/dist/http/schemas/platform.d.ts +38 -0
  187. package/dist/http/schemas/platform.js +19 -0
  188. package/dist/http/schemas/platform.js.map +1 -0
  189. package/dist/http/schemas/posts.d.ts +55 -35
  190. package/dist/http/schemas/posts.js +4 -4
  191. package/dist/http/schemas/posts.js.map +1 -1
  192. package/dist/http/schemas/profile.d.ts +1 -1
  193. package/dist/http/schemas/shared.d.ts +1 -11
  194. package/dist/http/schemas/shared.js +1 -10
  195. package/dist/http/schemas/shared.js.map +1 -1
  196. package/dist/http/schemas/students.d.ts +22 -0
  197. package/dist/http/schemas/students.js +3 -1
  198. package/dist/http/schemas/students.js.map +1 -1
  199. package/dist/http/scope.d.ts +9 -13
  200. package/dist/http/scope.js +29 -40
  201. package/dist/http/scope.js.map +1 -1
  202. package/dist/http/server.js +9 -0
  203. package/dist/http/server.js.map +1 -1
  204. package/dist/http/shutdown.d.ts +11 -0
  205. package/dist/http/shutdown.js +40 -0
  206. package/dist/http/shutdown.js.map +1 -0
  207. package/dist/http/sse.d.ts +19 -0
  208. package/dist/http/sse.js +104 -0
  209. package/dist/http/sse.js.map +1 -0
  210. package/dist/http/test-caller.d.ts +13 -0
  211. package/dist/http/test-caller.js +14 -0
  212. package/dist/http/test-caller.js.map +1 -0
  213. package/dist/http/well-known.js +2 -2
  214. package/dist/http/well-known.js.map +1 -1
  215. package/dist/index.d.ts +4 -2
  216. package/dist/index.js +4 -2
  217. package/dist/index.js.map +1 -1
  218. package/dist/packages/server/package.js +1 -1
  219. package/package.json +7 -6
  220. package/dist/http/routes/member/actor.d.ts +0 -14
  221. package/dist/http/routes/member/actor.js +0 -11
  222. package/dist/http/routes/member/actor.js.map +0 -1
@@ -2,196 +2,179 @@ import { AddDownloadAsset, CreateDownload, DownloadAssetParams, DownloadIdParam,
2
2
  import { AddBundleItem, BundleIdParam, BundleItemParams, BundlesQuery, CreateBundle, UpdateBundle } from "../../schemas/bundles.js";
3
3
  import { AssetsPage, AssetsQuery } from "../../schemas/assets.js";
4
4
  import "../../schemas/index.js";
5
- import { actor, defineTool } from "../tool.js";
5
+ import { defineTool } from "../tool.js";
6
6
  //#region src/http/mcp/tools/catalog.ts
7
7
  const catalogTools = [
8
8
  defineTool({
9
9
  name: "list_downloads",
10
10
  title: "List downloads",
11
11
  description: "Search and page through downloads: file collections a student can be granted. Filter by status or category.",
12
- scope: "downloads:read",
13
12
  kind: "read",
14
13
  idempotent: true,
15
14
  openWorld: false,
16
15
  input: DownloadsQuery,
17
- call: (input, { container, scope }) => container.content.listDownloads(scope.orgId, input)
16
+ call: (input, { container, caller }) => container.content.listDownloads(input, caller.actor)
18
17
  }),
19
18
  defineTool({
20
19
  name: "list_download_files",
21
20
  title: "List download files",
22
21
  description: "The files of a download, in order, with their display names.",
23
- scope: "downloads:read",
24
22
  kind: "read",
25
23
  idempotent: true,
26
24
  openWorld: false,
27
25
  input: DownloadIdParam,
28
- call: ({ downloadId }, { container, scope }) => container.content.listDownloadAssets(scope.orgId, downloadId)
26
+ call: ({ downloadId }, { container, caller }) => container.content.listDownloadAssets(downloadId, caller.actor)
29
27
  }),
30
28
  defineTool({
31
29
  name: "create_download",
32
30
  title: "Create download",
33
31
  description: "Create a draft download. Add files with add_download_file and publish it with update_download.",
34
- scope: "downloads:write",
35
32
  kind: "write",
36
33
  idempotent: false,
37
34
  openWorld: false,
38
35
  input: CreateDownload,
39
- call: (input, { container, scope }) => container.content.createDownload(scope.orgId, input)
36
+ call: (input, { container, caller }) => container.content.createDownload(input, caller.actor)
40
37
  }),
41
38
  defineTool({
42
39
  name: "update_download",
43
40
  title: "Update download",
44
41
  description: "Change a download title, description, category or cover image, or publish and unpublish it with status. Fields left out stay as they are.",
45
- scope: "downloads:write",
46
42
  kind: "write",
47
43
  idempotent: true,
48
44
  openWorld: false,
49
45
  input: UpdateDownload.extend(DownloadIdParam.shape),
50
- call: ({ downloadId, ...patch }, { container, scope }) => container.content.updateDownload(scope.orgId, downloadId, patch)
46
+ call: ({ downloadId, ...patch }, { container, caller }) => container.content.updateDownload(downloadId, patch, caller.actor)
51
47
  }),
52
48
  defineTool({
53
49
  name: "add_download_file",
54
50
  title: "Add file to download",
55
51
  description: "Add an uploaded file to the end of a download. Find file ids with list_media.",
56
- scope: "downloads:write",
57
52
  kind: "write",
58
53
  idempotent: false,
59
54
  openWorld: false,
60
55
  input: AddDownloadAsset.extend(DownloadIdParam.shape),
61
- call: ({ downloadId, ...file }, { container, scope }) => container.content.addDownloadAsset(scope.orgId, downloadId, file)
56
+ call: ({ downloadId, ...file }, { container, caller }) => container.content.addDownloadAsset(downloadId, file, caller.actor)
62
57
  }),
63
58
  defineTool({
64
59
  name: "rename_download_file",
65
60
  title: "Rename download file",
66
61
  description: "Set the name a file shows under in a download. null shows the file name.",
67
- scope: "downloads:write",
68
62
  kind: "write",
69
63
  idempotent: true,
70
64
  openWorld: false,
71
65
  input: RenameDownloadAsset.extend(DownloadAssetParams.shape),
72
- call: ({ downloadId, assetId, displayName }, { container, scope }) => container.content.renameDownloadAsset(scope.orgId, downloadId, assetId, displayName)
66
+ call: ({ downloadId, assetId, displayName }, { container, caller }) => container.content.renameDownloadAsset(downloadId, assetId, displayName, caller.actor)
73
67
  }),
74
68
  defineTool({
75
69
  name: "reorder_download_files",
76
70
  title: "Reorder download files",
77
71
  description: "Set the file order of a download. Pass every file id of the download in the new order.",
78
- scope: "downloads:write",
79
72
  kind: "write",
80
73
  idempotent: true,
81
74
  openWorld: false,
82
75
  input: ReorderDownloadAssets.extend(DownloadIdParam.shape),
83
- call: ({ downloadId, assetIds }, { container, scope }) => container.content.reorderDownloadAssets(scope.orgId, downloadId, assetIds)
76
+ call: ({ downloadId, assetIds }, { container, caller }) => container.content.reorderDownloadAssets(downloadId, assetIds, caller.actor)
84
77
  }),
85
78
  defineTool({
86
79
  name: "remove_download_file",
87
80
  title: "Remove file from download",
88
81
  description: "Take a file out of a download. The uploaded file itself is kept.",
89
- scope: "downloads:write",
90
82
  kind: "destructive",
91
83
  idempotent: true,
92
84
  openWorld: false,
93
85
  input: DownloadAssetParams,
94
- call: ({ downloadId, assetId }, { container, scope }) => container.content.removeDownloadAsset(scope.orgId, downloadId, assetId)
86
+ call: ({ downloadId, assetId }, { container, caller }) => container.content.removeDownloadAsset(downloadId, assetId, caller.actor)
95
87
  }),
96
88
  defineTool({
97
89
  name: "delete_download",
98
90
  title: "Delete download",
99
91
  description: "Permanently delete a download. The uploaded files are kept.",
100
- scope: "downloads:delete",
101
92
  kind: "destructive",
102
93
  idempotent: true,
103
94
  openWorld: false,
104
95
  input: DownloadIdParam,
105
- call: ({ downloadId }, { container, scope }) => container.content.removeDownload(scope.orgId, downloadId, actor(scope))
96
+ call: ({ downloadId }, { container, caller }) => container.content.removeDownload(downloadId, caller.actor)
106
97
  }),
107
98
  defineTool({
108
99
  name: "list_bundles",
109
100
  title: "List bundles",
110
- description: "Search and page through bundles: sets of courses, downloads and communities granted together.",
111
- scope: "bundles:read",
101
+ description: "Search and page through bundles: sets of courses, downloads, communities and events granted together.",
112
102
  kind: "read",
113
103
  idempotent: true,
114
104
  openWorld: false,
115
105
  input: BundlesQuery,
116
- call: (input, { container, scope }) => container.content.listBundles(scope.orgId, input)
106
+ call: (input, { container, caller }) => container.content.listBundles(input, caller.actor)
117
107
  }),
118
108
  defineTool({
119
109
  name: "list_bundle_items",
120
110
  title: "List bundle items",
121
- description: "The courses, downloads and communities in a bundle.",
122
- scope: "bundles:read",
111
+ description: "The courses, downloads, communities and events in a bundle.",
123
112
  kind: "read",
124
113
  idempotent: true,
125
114
  openWorld: false,
126
115
  input: BundleIdParam,
127
- call: ({ bundleId }, { container, scope }) => container.content.listBundleItems(scope.orgId, bundleId)
116
+ call: ({ bundleId }, { container, caller }) => container.content.listBundleItems(bundleId, caller.actor)
128
117
  }),
129
118
  defineTool({
130
119
  name: "create_bundle",
131
120
  title: "Create bundle",
132
- description: "Create a bundle, optionally with the course, download and community ids it starts with.",
133
- scope: "bundles:write",
121
+ description: "Create a bundle, optionally with the course, download, community and event ids it starts with.",
134
122
  kind: "write",
135
123
  idempotent: false,
136
124
  openWorld: false,
137
125
  input: CreateBundle,
138
- call: (input, { container, scope }) => container.content.createBundle(scope.orgId, input)
126
+ call: (input, { container, caller }) => container.content.createBundle(input, caller.actor)
139
127
  }),
140
128
  defineTool({
141
129
  name: "rename_bundle",
142
130
  title: "Rename bundle",
143
131
  description: "Rename a bundle.",
144
- scope: "bundles:write",
145
132
  kind: "write",
146
133
  idempotent: true,
147
134
  openWorld: false,
148
135
  input: UpdateBundle.extend(BundleIdParam.shape),
149
- call: ({ bundleId, ...patch }, { container, scope }) => container.content.updateBundle(scope.orgId, bundleId, patch)
136
+ call: ({ bundleId, ...patch }, { container, caller }) => container.content.updateBundle(bundleId, patch, caller.actor)
150
137
  }),
151
138
  defineTool({
152
139
  name: "add_bundle_item",
153
140
  title: "Add to bundle",
154
- description: "Add a course, download or community to a bundle. Returns the bundle items.",
155
- scope: "bundles:write",
141
+ description: "Add a course, download, community or event to a bundle. Returns the bundle items.",
156
142
  kind: "write",
157
143
  idempotent: false,
158
144
  openWorld: false,
159
145
  input: AddBundleItem.extend(BundleIdParam.shape),
160
- call: ({ bundleId, contentId }, { container, scope }) => container.content.addBundleItem(scope.orgId, bundleId, contentId)
146
+ call: ({ bundleId, contentId }, { container, caller }) => container.content.addBundleItem(bundleId, contentId, caller.actor)
161
147
  }),
162
148
  defineTool({
163
149
  name: "remove_bundle_item",
164
150
  title: "Remove from bundle",
165
- description: "Take a course, download or community out of a bundle. Returns the remaining items.",
166
- scope: "bundles:write",
151
+ description: "Take a course, download, community or event out of a bundle. Returns the remaining items.",
167
152
  kind: "destructive",
168
153
  idempotent: true,
169
154
  openWorld: false,
170
155
  input: BundleItemParams,
171
- call: ({ bundleId, contentId }, { container, scope }) => container.content.removeBundleItem(scope.orgId, bundleId, contentId)
156
+ call: ({ bundleId, contentId }, { container, caller }) => container.content.removeBundleItem(bundleId, contentId, caller.actor)
172
157
  }),
173
158
  defineTool({
174
159
  name: "delete_bundle",
175
160
  title: "Delete bundle",
176
- description: "Permanently delete a bundle. Its courses, downloads and communities are kept.",
177
- scope: "bundles:delete",
161
+ description: "Permanently delete a bundle. Its courses, downloads, communities and events are kept.",
178
162
  kind: "destructive",
179
163
  idempotent: true,
180
164
  openWorld: false,
181
165
  input: BundleIdParam,
182
- call: ({ bundleId }, { container, scope }) => container.content.deleteBundle(scope.orgId, bundleId)
166
+ call: ({ bundleId }, { container, caller }) => container.content.deleteBundle(bundleId, caller.actor)
183
167
  }),
184
168
  defineTool({
185
169
  name: "list_media",
186
170
  title: "List media",
187
- description: "Search and page through uploaded files, to use in downloads or as cover images of courses, downloads and communities. Uploading is done in the admin app.",
188
- scope: "media:read",
171
+ description: "Search and page through uploaded files, to use in downloads and events or as cover images of courses, downloads, communities and events. Uploading is done in the admin app.",
189
172
  kind: "read",
190
173
  idempotent: true,
191
174
  openWorld: false,
192
175
  input: AssetsQuery,
193
176
  output: AssetsPage,
194
- call: (input, { container, scope }) => container.assets.list(scope.orgId, input)
177
+ call: (input, { container, caller }) => container.assets.list(input, caller.actor)
195
178
  })
196
179
  ];
197
180
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.js","names":[],"sources":["../../../../src/http/mcp/tools/catalog.ts"],"sourcesContent":["import {\n AddBundleItem,\n AddDownloadAsset,\n AssetsPage,\n AssetsQuery,\n BundleIdParam,\n BundleItemParams,\n BundlesQuery,\n CreateBundle,\n CreateDownload,\n DownloadAssetParams,\n DownloadIdParam,\n DownloadsQuery,\n RenameDownloadAsset,\n ReorderDownloadAssets,\n UpdateBundle,\n UpdateDownload,\n} from '../../schemas/index.js';\nimport { actor, defineTool, type Tool } from '../tool.js';\n\nexport const catalogTools: Tool[] = [\n defineTool({\n name: 'list_downloads',\n title: 'List downloads',\n description:\n 'Search and page through downloads: file collections a student can be granted. Filter by status or category.',\n scope: 'downloads:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: DownloadsQuery,\n call: (input, { container, scope }) => container.content.listDownloads(scope.orgId, input),\n }),\n defineTool({\n name: 'list_download_files',\n title: 'List download files',\n description: 'The files of a download, in order, with their display names.',\n scope: 'downloads:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: DownloadIdParam,\n call: ({ downloadId }, { container, scope }) =>\n container.content.listDownloadAssets(scope.orgId, downloadId),\n }),\n defineTool({\n name: 'create_download',\n title: 'Create download',\n description:\n 'Create a draft download. Add files with add_download_file and publish it with update_download.',\n scope: 'downloads:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateDownload,\n call: (input, { container, scope }) => container.content.createDownload(scope.orgId, input),\n }),\n defineTool({\n name: 'update_download',\n title: 'Update download',\n description:\n 'Change a download title, description, category or cover image, or publish and unpublish it with status. Fields left out stay as they are.',\n scope: 'downloads:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateDownload.extend(DownloadIdParam.shape),\n call: ({ downloadId, ...patch }, { container, scope }) =>\n container.content.updateDownload(scope.orgId, downloadId, patch),\n }),\n defineTool({\n name: 'add_download_file',\n title: 'Add file to download',\n description: 'Add an uploaded file to the end of a download. Find file ids with list_media.',\n scope: 'downloads:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: AddDownloadAsset.extend(DownloadIdParam.shape),\n call: ({ downloadId, ...file }, { container, scope }) =>\n container.content.addDownloadAsset(scope.orgId, downloadId, file),\n }),\n defineTool({\n name: 'rename_download_file',\n title: 'Rename download file',\n description: 'Set the name a file shows under in a download. null shows the file name.',\n scope: 'downloads:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: RenameDownloadAsset.extend(DownloadAssetParams.shape),\n call: ({ downloadId, assetId, displayName }, { container, scope }) =>\n container.content.renameDownloadAsset(scope.orgId, downloadId, assetId, displayName),\n }),\n defineTool({\n name: 'reorder_download_files',\n title: 'Reorder download files',\n description:\n 'Set the file order of a download. Pass every file id of the download in the new order.',\n scope: 'downloads:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ReorderDownloadAssets.extend(DownloadIdParam.shape),\n call: ({ downloadId, assetIds }, { container, scope }) =>\n container.content.reorderDownloadAssets(scope.orgId, downloadId, assetIds),\n }),\n defineTool({\n name: 'remove_download_file',\n title: 'Remove file from download',\n description: 'Take a file out of a download. The uploaded file itself is kept.',\n scope: 'downloads:write',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: DownloadAssetParams,\n call: ({ downloadId, assetId }, { container, scope }) =>\n container.content.removeDownloadAsset(scope.orgId, downloadId, assetId),\n }),\n defineTool({\n name: 'delete_download',\n title: 'Delete download',\n description: 'Permanently delete a download. The uploaded files are kept.',\n scope: 'downloads:delete',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: DownloadIdParam,\n call: ({ downloadId }, { container, scope }) =>\n container.content.removeDownload(scope.orgId, downloadId, actor(scope)),\n }),\n defineTool({\n name: 'list_bundles',\n title: 'List bundles',\n description:\n 'Search and page through bundles: sets of courses, downloads and communities granted together.',\n scope: 'bundles:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: BundlesQuery,\n call: (input, { container, scope }) => container.content.listBundles(scope.orgId, input),\n }),\n defineTool({\n name: 'list_bundle_items',\n title: 'List bundle items',\n description: 'The courses, downloads and communities in a bundle.',\n scope: 'bundles:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: BundleIdParam,\n call: ({ bundleId }, { container, scope }) =>\n container.content.listBundleItems(scope.orgId, bundleId),\n }),\n defineTool({\n name: 'create_bundle',\n title: 'Create bundle',\n description:\n 'Create a bundle, optionally with the course, download and community ids it starts with.',\n scope: 'bundles:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateBundle,\n call: (input, { container, scope }) => container.content.createBundle(scope.orgId, input),\n }),\n defineTool({\n name: 'rename_bundle',\n title: 'Rename bundle',\n description: 'Rename a bundle.',\n scope: 'bundles:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateBundle.extend(BundleIdParam.shape),\n call: ({ bundleId, ...patch }, { container, scope }) =>\n container.content.updateBundle(scope.orgId, bundleId, patch),\n }),\n defineTool({\n name: 'add_bundle_item',\n title: 'Add to bundle',\n description: 'Add a course, download or community to a bundle. Returns the bundle items.',\n scope: 'bundles:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: AddBundleItem.extend(BundleIdParam.shape),\n call: ({ bundleId, contentId }, { container, scope }) =>\n container.content.addBundleItem(scope.orgId, bundleId, contentId),\n }),\n defineTool({\n name: 'remove_bundle_item',\n title: 'Remove from bundle',\n description:\n 'Take a course, download or community out of a bundle. Returns the remaining items.',\n scope: 'bundles:write',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: BundleItemParams,\n call: ({ bundleId, contentId }, { container, scope }) =>\n container.content.removeBundleItem(scope.orgId, bundleId, contentId),\n }),\n defineTool({\n name: 'delete_bundle',\n title: 'Delete bundle',\n description: 'Permanently delete a bundle. Its courses, downloads and communities are kept.',\n scope: 'bundles:delete',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: BundleIdParam,\n call: ({ bundleId }, { container, scope }) =>\n container.content.deleteBundle(scope.orgId, bundleId),\n }),\n defineTool({\n name: 'list_media',\n title: 'List media',\n description:\n 'Search and page through uploaded files, to use in downloads or as cover images of courses, downloads and communities. Uploading is done in the admin app.',\n scope: 'media:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: AssetsQuery,\n output: AssetsPage,\n call: (input, { container, scope }) => container.assets.list(scope.orgId, input),\n }),\n];\n"],"mappings":";;;;;;AAoBA,MAAa,eAAuB;CAClC,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,YAAY,UAAU,QAAQ,cAAc,MAAM,OAAO,KAAK;CAC3F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,cAAc,EAAE,WAAW,YAClC,UAAU,QAAQ,mBAAmB,MAAM,OAAO,UAAU;CAChE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,YAAY,UAAU,QAAQ,eAAe,MAAM,OAAO,KAAK;CAC5F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,O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AU,aAAa,EAAE,WAAW,YAC3C,UAAU,QAAQ,iBAAiB,MAAM,OAAO,UAAU,SAAS;CACvE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,YAAY,EAAE,WAAW,YAChC,UAAU,QAAQ,aAAa,MAAM,OAAO,QAAQ;CACxD,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,QAAQ;EACR,OAAO,OAAO,EAAE,WAAW,YAAY,UAAU,OAAO,KAAK,MAAM,OAAO,KAAK;CACjF,CAAC;AACH"}
1
+ {"version":3,"file":"catalog.js","names":[],"sources":["../../../../src/http/mcp/tools/catalog.ts"],"sourcesContent":["import {\n AddBundleItem,\n AddDownloadAsset,\n AssetsPage,\n AssetsQuery,\n BundleIdParam,\n BundleItemParams,\n BundlesQuery,\n CreateBundle,\n CreateDownload,\n DownloadAssetParams,\n DownloadIdParam,\n DownloadsQuery,\n RenameDownloadAsset,\n ReorderDownloadAssets,\n UpdateBundle,\n UpdateDownload,\n} from '../../schemas/index.js';\nimport { defineTool, type Tool } from '../tool.js';\n\nexport const catalogTools: Tool[] = [\n defineTool({\n name: 'list_downloads',\n title: 'List downloads',\n description:\n 'Search and page through downloads: file collections a student can be granted. Filter by status or category.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: DownloadsQuery,\n call: (input, { container, caller }) => container.content.listDownloads(input, caller.actor),\n }),\n defineTool({\n name: 'list_download_files',\n title: 'List download files',\n description: 'The files of a download, in order, with their display names.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: DownloadIdParam,\n call: ({ downloadId }, { container, caller }) =>\n container.content.listDownloadAssets(downloadId, caller.actor),\n }),\n defineTool({\n name: 'create_download',\n title: 'Create download',\n description:\n 'Create a draft download. Add files with add_download_file and publish it with update_download.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateDownload,\n call: (input, { container, caller }) => container.content.createDownload(input, caller.actor),\n }),\n defineTool({\n name: 'update_download',\n title: 'Update download',\n description:\n 'Change a download title, description, category or cover image, or publish and unpublish it with status. Fields left out stay as they are.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateDownload.extend(DownloadIdParam.shape),\n call: ({ downloadId, ...patch }, { container, caller }) =>\n container.content.updateDownload(downloadId, patch, caller.actor),\n }),\n defineTool({\n name: 'add_download_file',\n title: 'Add file to download',\n description: 'Add an uploaded file to the end of a download. Find file ids with list_media.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: AddDownloadAsset.extend(DownloadIdParam.shape),\n call: ({ downloadId, ...file }, { container, caller }) =>\n container.content.addDownloadAsset(downloadId, file, caller.actor),\n }),\n defineTool({\n name: 'rename_download_file',\n title: 'Rename download file',\n description: 'Set the name a file shows under in a download. null shows the file name.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: RenameDownloadAsset.extend(DownloadAssetParams.shape),\n call: ({ downloadId, assetId, displayName }, { container, caller }) =>\n container.content.renameDownloadAsset(downloadId, assetId, displayName, caller.actor),\n }),\n defineTool({\n name: 'reorder_download_files',\n title: 'Reorder download files',\n description:\n 'Set the file order of a download. Pass every file id of the download in the new order.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ReorderDownloadAssets.extend(DownloadIdParam.shape),\n call: ({ downloadId, assetIds }, { container, caller }) =>\n container.content.reorderDownloadAssets(downloadId, assetIds, caller.actor),\n }),\n defineTool({\n name: 'remove_download_file',\n title: 'Remove file from download',\n description: 'Take a file out of a download. The uploaded file itself is kept.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: DownloadAssetParams,\n call: ({ downloadId, assetId }, { container, caller }) =>\n container.content.removeDownloadAsset(downloadId, assetId, caller.actor),\n }),\n defineTool({\n name: 'delete_download',\n title: 'Delete download',\n description: 'Permanently delete a download. The uploaded files are kept.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: DownloadIdParam,\n call: ({ downloadId }, { container, caller }) =>\n container.content.removeDownload(downloadId, caller.actor),\n }),\n defineTool({\n name: 'list_bundles',\n title: 'List bundles',\n description:\n 'Search and page through bundles: sets of courses, downloads, communities and events granted together.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: BundlesQuery,\n call: (input, { container, caller }) => container.content.listBundles(input, caller.actor),\n }),\n defineTool({\n name: 'list_bundle_items',\n title: 'List bundle items',\n description: 'The courses, downloads, communities and events in a bundle.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: BundleIdParam,\n call: ({ bundleId }, { container, caller }) =>\n container.content.listBundleItems(bundleId, caller.actor),\n }),\n defineTool({\n name: 'create_bundle',\n title: 'Create bundle',\n description:\n 'Create a bundle, optionally with the course, download, community and event ids it starts with.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateBundle,\n call: (input, { container, caller }) => container.content.createBundle(input, caller.actor),\n }),\n defineTool({\n name: 'rename_bundle',\n title: 'Rename bundle',\n description: 'Rename a bundle.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateBundle.extend(BundleIdParam.shape),\n call: ({ bundleId, ...patch }, { container, caller }) =>\n container.content.updateBundle(bundleId, patch, caller.actor),\n }),\n defineTool({\n name: 'add_bundle_item',\n title: 'Add to bundle',\n description:\n 'Add a course, download, community or event to a bundle. Returns the bundle items.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: AddBundleItem.extend(BundleIdParam.shape),\n call: ({ bundleId, contentId }, { container, caller }) =>\n container.content.addBundleItem(bundleId, contentId, caller.actor),\n }),\n defineTool({\n name: 'remove_bundle_item',\n title: 'Remove from bundle',\n description:\n 'Take a course, download, community or event out of a bundle. Returns the remaining items.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: BundleItemParams,\n call: ({ bundleId, contentId }, { container, caller }) =>\n container.content.removeBundleItem(bundleId, contentId, caller.actor),\n }),\n defineTool({\n name: 'delete_bundle',\n title: 'Delete bundle',\n description:\n 'Permanently delete a bundle. Its courses, downloads, communities and events are kept.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: BundleIdParam,\n call: ({ bundleId }, { container, caller }) =>\n container.content.deleteBundle(bundleId, caller.actor),\n }),\n defineTool({\n name: 'list_media',\n title: 'List media',\n description:\n 'Search and page through uploaded files, to use in downloads and events or as cover images of courses, downloads, communities and events. Uploading is done in the admin app.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: AssetsQuery,\n output: AssetsPage,\n call: (input, { container, caller }) => container.assets.list(input, caller.actor),\n }),\n];\n"],"mappings":";;;;;;AAoBA,MAAa,eAAuB;CAClC,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,aAAa,UAAU,QAAQ,cAAc,OAAO,OAAO,KAAK;CAC7F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,cAAc,EAAE,WAAW,aAClC,UAAU,QAAQ,mBAAmB,YAAY,OAAO,KAAK;CACjE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,aAAa,UAAU,QAAQ,eAAe,OAAO,OAAO,KAAK;CAC9F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,eAAe,OAAO,gBAAgB,KAAK;EAClD,OAAO,EAAE,YAAY,GAAG,SAAS,EAAE,WAAW,aAC5C,UAAU,QAAQ,eAAe,YAAY,OAAO,OAAO,KAAK;CACpE,CAAC;CACD,WAAW;EACT,MAAM;EAC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ACP,QAAQ;EACR,OAAO,OAAO,EAAE,WAAW,aAAa,UAAU,OAAO,KAAK,OAAO,OAAO,KAAK;CACnF,CAAC;AACH"}
@@ -1,67 +1,57 @@
1
- import { CommentIdParam, CommentsQuery, DiscussionActivityParam, ReplyToComment } from "../../schemas/discussion.js";
1
+ import { CommentIdParam, CommentsQuery, ReplyToComment } from "../../schemas/discussion.js";
2
2
  import "../../schemas/index.js";
3
- import { actor, defineTool } from "../tool.js";
3
+ import { defineTool } from "../tool.js";
4
4
  //#region src/http/mcp/tools/comments.ts
5
5
  const commentTools = [
6
6
  defineTool({
7
7
  name: "list_comments",
8
8
  title: "List comments",
9
9
  description: "The comment moderation queue. Filter by status, reported, course, activity or author. Each comment carries its activityId and parentId.",
10
- scope: "comments:read",
11
10
  kind: "read",
12
11
  idempotent: true,
13
12
  openWorld: false,
14
13
  input: CommentsQuery,
15
- call: (input, { container, scope }) => container.discussion.listComments(scope.orgId, input)
14
+ call: (input, { container, caller }) => container.discussion.listComments(input, caller.actor)
16
15
  }),
17
16
  defineTool({
18
17
  name: "publish_comment",
19
18
  title: "Publish comment",
20
19
  description: "Publish a comment: approves one waiting for review, or restores a removed one.",
21
- scope: "comments:moderate",
22
20
  kind: "write",
23
21
  idempotent: true,
24
22
  openWorld: false,
25
23
  input: CommentIdParam,
26
- call: ({ commentId }, { container, scope }) => container.discussion.publish(scope.orgId, commentId, actor(scope), null)
24
+ call: ({ commentId }, { container, caller }) => container.discussion.publish(commentId, "lesson", caller.actor)
27
25
  }),
28
26
  defineTool({
29
27
  name: "dismiss_comment_reports",
30
28
  title: "Dismiss comment reports",
31
29
  description: "Mark the reports on a comment as resolved. The comment's status does not change.",
32
- scope: "comments:moderate",
33
30
  kind: "write",
34
31
  idempotent: true,
35
32
  openWorld: false,
36
33
  input: CommentIdParam,
37
- call: ({ commentId }, { container, scope }) => container.discussion.resolveReports(scope.orgId, commentId, actor(scope), null)
34
+ call: ({ commentId }, { container, caller }) => container.discussion.resolveReports(commentId, "lesson", caller.actor)
38
35
  }),
39
36
  defineTool({
40
37
  name: "reply_to_comment",
41
38
  title: "Reply to comment",
42
- description: "Reply to a published top-level comment as yourself. Pass its activityId and its id. To answer a reply, reply to its parentId.",
43
- scope: "comments:moderate",
39
+ description: "Reply to a published comment as yourself. A reply to a reply attaches to its top-level comment.",
44
40
  kind: "write",
45
41
  idempotent: false,
46
42
  openWorld: false,
47
- input: ReplyToComment.extend(CommentIdParam.shape).extend(DiscussionActivityParam.shape),
48
- call: ({ activityId, commentId, body }, { container, scope }) => container.discussion.postComment(scope.orgId, {
49
- actor: actor(scope),
50
- activityId,
51
- parentId: commentId,
52
- body
53
- })
43
+ input: ReplyToComment.extend(CommentIdParam.shape),
44
+ call: ({ commentId, body }, { container, caller }) => container.discussion.replyToComment(commentId, body, caller.actor)
54
45
  }),
55
46
  defineTool({
56
47
  name: "remove_comment",
57
48
  title: "Remove comment",
58
49
  description: "Take a comment down.",
59
- scope: "comments:moderate",
60
50
  kind: "destructive",
61
51
  idempotent: true,
62
52
  openWorld: false,
63
53
  input: CommentIdParam,
64
- call: ({ commentId }, { container, scope }) => container.discussion.remove(scope.orgId, commentId, actor(scope), null)
54
+ call: ({ commentId }, { container, caller }) => container.discussion.remove(commentId, "lesson", caller.actor)
65
55
  })
66
56
  ];
67
57
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"comments.js","names":[],"sources":["../../../../src/http/mcp/tools/comments.ts"],"sourcesContent":["import {\n CommentIdParam,\n CommentsQuery,\n DiscussionActivityParam,\n ReplyToComment,\n} from '../../schemas/index.js';\nimport { actor, defineTool, type Tool } from '../tool.js';\n\nexport const commentTools: Tool[] = [\n defineTool({\n name: 'list_comments',\n title: 'List comments',\n description:\n 'The comment moderation queue. Filter by status, reported, course, activity or author. Each comment carries its activityId and parentId.',\n scope: 'comments:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommentsQuery,\n call: (input, { container, scope }) => container.discussion.listComments(scope.orgId, input),\n }),\n defineTool({\n name: 'publish_comment',\n title: 'Publish comment',\n description: 'Publish a comment: approves one waiting for review, or restores a removed one.',\n scope: 'comments:moderate',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommentIdParam,\n call: ({ commentId }, { container, scope }) =>\n container.discussion.publish(scope.orgId, commentId, actor(scope), null),\n }),\n defineTool({\n name: 'dismiss_comment_reports',\n title: 'Dismiss comment reports',\n description: \"Mark the reports on a comment as resolved. The comment's status does not change.\",\n scope: 'comments:moderate',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommentIdParam,\n call: ({ commentId }, { container, scope }) =>\n container.discussion.resolveReports(scope.orgId, commentId, actor(scope), null),\n }),\n defineTool({\n name: 'reply_to_comment',\n title: 'Reply to comment',\n description:\n 'Reply to a published top-level comment as yourself. Pass its activityId and its id. To answer a reply, reply to its parentId.',\n scope: 'comments:moderate',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: ReplyToComment.extend(CommentIdParam.shape).extend(DiscussionActivityParam.shape),\n call: ({ activityId, commentId, body }, { container, scope }) =>\n container.discussion.postComment(scope.orgId, {\n actor: actor(scope),\n activityId,\n parentId: commentId,\n body,\n }),\n }),\n defineTool({\n name: 'remove_comment',\n title: 'Remove comment',\n description: 'Take a comment down.',\n scope: 'comments:moderate',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommentIdParam,\n call: ({ commentId }, { container, scope }) =>\n container.discussion.remove(scope.orgId, commentId, actor(scope), null),\n }),\n];\n"],"mappings":";;;;AAQA,MAAa,eAAuB;CAClC,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,YAAY,UAAU,WAAW,aAAa,MAAM,OAAO,KAAK;CAC7F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,EAAE,WAAW,YACjC,UAAU,WAAW,QAAQ,MAAM,OAAO,WAAW,MAAM,KAAK,GAAG,IAAI;CAC3E,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,EAAE,WAAW,YACjC,UAAU,WAAW,eAAe,MAAM,OAAO,WAAW,MAAM,KAAK,GAAG,IAAI;CAClF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,eAAe,OAAO,eAAe,KAAK,CAAC,CAAC,OAAO,wBAAwB,KAAK;EACvF,OAAO,EAAE,YAAY,WAAW,QAAQ,EAAE,WAAW,YACnD,UAAU,WAAW,YAAY,MAAM,OAAO;GAC5C,OAAO,MAAM,KAAK;GAClB;GACA,UAAU;GACV;EACF,CAAC;CACL,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,EAAE,WAAW,YACjC,UAAU,WAAW,OAAO,MAAM,OAAO,WAAW,MAAM,KAAK,GAAG,IAAI;CAC1E,CAAC;AACH"}
1
+ {"version":3,"file":"comments.js","names":[],"sources":["../../../../src/http/mcp/tools/comments.ts"],"sourcesContent":["import { CommentIdParam, CommentsQuery, ReplyToComment } from '../../schemas/index.js';\nimport { defineTool, type Tool } from '../tool.js';\n\nexport const commentTools: Tool[] = [\n defineTool({\n name: 'list_comments',\n title: 'List comments',\n description:\n 'The comment moderation queue. Filter by status, reported, course, activity or author. Each comment carries its activityId and parentId.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommentsQuery,\n call: (input, { container, caller }) => container.discussion.listComments(input, caller.actor),\n }),\n defineTool({\n name: 'publish_comment',\n title: 'Publish comment',\n description: 'Publish a comment: approves one waiting for review, or restores a removed one.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommentIdParam,\n call: ({ commentId }, { container, caller }) =>\n container.discussion.publish(commentId, 'lesson', caller.actor),\n }),\n defineTool({\n name: 'dismiss_comment_reports',\n title: 'Dismiss comment reports',\n description: \"Mark the reports on a comment as resolved. The comment's status does not change.\",\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommentIdParam,\n call: ({ commentId }, { container, caller }) =>\n container.discussion.resolveReports(commentId, 'lesson', caller.actor),\n }),\n defineTool({\n name: 'reply_to_comment',\n title: 'Reply to comment',\n description:\n 'Reply to a published comment as yourself. A reply to a reply attaches to its top-level comment.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: ReplyToComment.extend(CommentIdParam.shape),\n call: ({ commentId, body }, { container, caller }) =>\n container.discussion.replyToComment(commentId, body, caller.actor),\n }),\n defineTool({\n name: 'remove_comment',\n title: 'Remove comment',\n description: 'Take a comment down.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommentIdParam,\n call: ({ commentId }, { container, caller }) =>\n container.discussion.remove(commentId, 'lesson', caller.actor),\n }),\n];\n"],"mappings":";;;;AAGA,MAAa,eAAuB;CAClC,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,aAAa,UAAU,WAAW,aAAa,OAAO,OAAO,KAAK;CAC/F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,EAAE,WAAW,aACjC,UAAU,WAAW,QAAQ,WAAW,UAAU,OAAO,KAAK;CAClE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,EAAE,WAAW,aACjC,UAAU,WAAW,eAAe,WAAW,UAAU,OAAO,KAAK;CACzE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,eAAe,OAAO,eAAe,KAAK;EACjD,OAAO,EAAE,WAAW,QAAQ,EAAE,WAAW,aACvC,UAAU,WAAW,eAAe,WAAW,MAAM,OAAO,KAAK;CACrE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,EAAE,WAAW,aACjC,UAAU,WAAW,OAAO,WAAW,UAAU,OAAO,KAAK;CACjE,CAAC;AACH"}
@@ -1,172 +1,157 @@
1
1
  import { CommunitiesQuery, CommunityIdParam, CommunitySpaceParam, CreateCommunity, CreateSpace, OrderedIds, PatchDmSettings, SetSpaceTopics, SpaceLinkBody, SpaceLinkParam, UpdateCommunity, UpdateSpace } from "../../schemas/community.js";
2
2
  import "../../schemas/index.js";
3
- import { actor, defineTool } from "../tool.js";
3
+ import { defineTool } from "../tool.js";
4
4
  //#region src/http/mcp/tools/communities.ts
5
5
  const communityTools = [
6
6
  defineTool({
7
7
  name: "list_communities",
8
8
  title: "List communities",
9
9
  description: "Search and page through the communities, drafts included, each with its status and direct-message settings. Filter by status, search by title.",
10
- scope: "communities:read",
11
10
  kind: "read",
12
11
  idempotent: true,
13
12
  openWorld: false,
14
13
  input: CommunitiesQuery,
15
- call: (input, { container, scope }) => container.content.listCommunities(scope.orgId, input)
14
+ call: (input, { container, caller }) => container.content.listCommunities(input, caller.actor)
16
15
  }),
17
16
  defineTool({
18
17
  name: "list_spaces",
19
18
  title: "List spaces",
20
19
  description: "The spaces of a community, in order, each with its access rule, topics and links.",
21
- scope: "communities:read",
22
20
  kind: "read",
23
21
  idempotent: true,
24
22
  openWorld: false,
25
23
  input: CommunityIdParam,
26
- call: ({ communityId }, { container, scope }) => container.content.listSpaces(scope.orgId, communityId)
24
+ call: ({ communityId }, { container, caller }) => container.content.listSpaces(communityId, caller.actor)
27
25
  }),
28
26
  defineTool({
29
27
  name: "create_community",
30
28
  title: "Create community",
31
29
  description: "Create a draft community with the default direct-message settings and no spaces. Add spaces with create_space and publish it with update_community.",
32
- scope: "communities:write",
33
30
  kind: "write",
34
31
  idempotent: false,
35
32
  openWorld: false,
36
33
  input: CreateCommunity,
37
- call: (input, { container, scope }) => container.content.createCommunity(scope.orgId, input, actor(scope))
34
+ call: (input, { container, caller }) => container.content.createCommunity(input, caller.actor)
38
35
  }),
39
36
  defineTool({
40
37
  name: "update_community",
41
38
  title: "Update community",
42
39
  description: "Change a community title, description or cover image, or publish and unpublish it with status. The cover must be a ready image from list_media; null clears it. Fields left out stay as they are.",
43
- scope: "communities:write",
44
40
  kind: "write",
45
41
  idempotent: true,
46
42
  openWorld: false,
47
43
  input: UpdateCommunity.extend(CommunityIdParam.shape),
48
- call: ({ communityId, ...input }, { container, scope }) => container.content.updateCommunity(scope.orgId, communityId, input, actor(scope))
44
+ call: ({ communityId, ...input }, { container, caller }) => container.content.updateCommunity(communityId, input, caller.actor)
49
45
  }),
50
46
  defineTool({
51
47
  name: "update_community_messaging",
52
48
  title: "Update community messaging",
53
49
  description: "Change the direct-message settings of a community: who may message whom from now on. Settings left out stay as they are.",
54
- scope: "communities:write",
55
50
  kind: "write",
56
51
  idempotent: true,
57
52
  openWorld: false,
58
53
  input: PatchDmSettings.extend(CommunityIdParam.shape),
59
- call: ({ communityId, ...input }, { container, scope }) => container.content.patchCommunitySettings(scope.orgId, communityId, input, actor(scope))
54
+ call: ({ communityId, ...input }, { container, caller }) => container.content.patchCommunitySettings(communityId, input, caller.actor)
60
55
  }),
61
56
  defineTool({
62
57
  name: "create_space",
63
58
  title: "Create space",
64
59
  description: "Add a space at the end of a community. Its access rule decides who can open it: all members, by request or by invite. A space open to all members cannot have a capacity.",
65
- scope: "communities:write",
66
60
  kind: "write",
67
61
  idempotent: false,
68
62
  openWorld: false,
69
63
  input: CreateSpace.extend(CommunityIdParam.shape),
70
- call: ({ communityId, ...input }, { container, scope }) => container.content.createSpace(scope.orgId, communityId, input, actor(scope))
64
+ call: ({ communityId, ...input }, { container, caller }) => container.content.createSpace(communityId, input, caller.actor)
71
65
  }),
72
66
  defineTool({
73
67
  name: "update_space",
74
68
  title: "Update space",
75
- description: "Change a space name, description, access rule, capacity or settings. settings merges into the current settings. Fields left out stay as they are.",
76
- scope: "communities:write",
69
+ description: "Change a space name, description, access rule, capacity, settings, cover, background or icon. settings merges into the current settings. Each image must be a ready image from list_media; null clears it. Fields left out stay as they are.",
77
70
  kind: "write",
78
71
  idempotent: true,
79
72
  openWorld: false,
80
73
  input: UpdateSpace.extend(CommunitySpaceParam.shape),
81
- call: ({ communityId, spaceId, ...input }, { container, scope }) => container.content.updateSpace(scope.orgId, communityId, spaceId, input, actor(scope))
74
+ call: ({ communityId, spaceId, ...input }, { container, caller }) => container.content.updateSpace(communityId, spaceId, input, caller.actor)
82
75
  }),
83
76
  defineTool({
84
77
  name: "reorder_spaces",
85
78
  title: "Reorder spaces",
86
79
  description: "Set the space order of a community. Pass every space id of the community in the new order.",
87
- scope: "communities:write",
88
80
  kind: "write",
89
81
  idempotent: true,
90
82
  openWorld: false,
91
83
  input: OrderedIds.extend(CommunityIdParam.shape),
92
- call: ({ communityId, ids }, { container, scope }) => container.content.reorderSpaces(scope.orgId, communityId, ids, actor(scope))
84
+ call: ({ communityId, ids }, { container, caller }) => container.content.reorderSpaces(communityId, ids, caller.actor)
93
85
  }),
94
86
  defineTool({
95
87
  name: "set_space_topics",
96
88
  title: "Set space topics",
97
89
  description: "Replace the topics of a space. An entry with an id keeps and renames that topic, one without adds a topic, and a topic left out is deleted. A topic that posts use cannot be deleted.",
98
- scope: "communities:write",
99
90
  kind: "write",
100
91
  idempotent: true,
101
92
  openWorld: false,
102
93
  input: SetSpaceTopics.extend(CommunitySpaceParam.shape),
103
- call: ({ communityId, spaceId, ...input }, { container, scope }) => container.content.setSpaceTopics(scope.orgId, communityId, spaceId, input, actor(scope))
94
+ call: ({ communityId, spaceId, ...input }, { container, caller }) => container.content.setSpaceTopics(communityId, spaceId, input, caller.actor)
104
95
  }),
105
96
  defineTool({
106
97
  name: "add_space_link",
107
98
  title: "Add space link",
108
99
  description: "Link a course, download or community into a space, after its other links. Returns the space.",
109
- scope: "communities:write",
110
100
  kind: "write",
111
101
  idempotent: false,
112
102
  openWorld: false,
113
103
  input: SpaceLinkBody.extend(CommunitySpaceParam.shape),
114
- call: ({ communityId, spaceId, contentId }, { container, scope }) => container.content.addSpaceLink(scope.orgId, communityId, spaceId, contentId, actor(scope))
104
+ call: ({ communityId, spaceId, contentId }, { container, caller }) => container.content.addSpaceLink(communityId, spaceId, contentId, caller.actor)
115
105
  }),
116
106
  defineTool({
117
107
  name: "reorder_space_links",
118
108
  title: "Reorder space links",
119
109
  description: "Set the link order of a space. Pass every link id of the space in the new order.",
120
- scope: "communities:write",
121
110
  kind: "write",
122
111
  idempotent: true,
123
112
  openWorld: false,
124
113
  input: OrderedIds.extend(CommunitySpaceParam.shape),
125
- call: ({ communityId, spaceId, ids }, { container, scope }) => container.content.reorderSpaceLinks(scope.orgId, communityId, spaceId, ids, actor(scope))
114
+ call: ({ communityId, spaceId, ids }, { container, caller }) => container.content.reorderSpaceLinks(communityId, spaceId, ids, caller.actor)
126
115
  }),
127
116
  defineTool({
128
117
  name: "remove_space_link",
129
118
  title: "Remove space link",
130
119
  description: "Take a link out of a space. The linked content itself is kept. Returns the space.",
131
- scope: "communities:write",
132
120
  kind: "destructive",
133
121
  idempotent: true,
134
122
  openWorld: false,
135
123
  input: SpaceLinkParam,
136
- call: ({ communityId, spaceId, linkId }, { container, scope }) => container.content.removeSpaceLink(scope.orgId, communityId, spaceId, linkId, actor(scope))
124
+ call: ({ communityId, spaceId, linkId }, { container, caller }) => container.content.removeSpaceLink(communityId, spaceId, linkId, caller.actor)
137
125
  }),
138
126
  defineTool({
139
127
  name: "delete_space",
140
128
  title: "Delete space",
141
129
  description: "Permanently delete a space with its posts, comments and members.",
142
- scope: "communities:delete",
143
130
  kind: "destructive",
144
131
  idempotent: true,
145
132
  openWorld: false,
146
133
  input: CommunitySpaceParam,
147
- call: ({ communityId, spaceId }, { container, scope }) => container.content.deleteSpace(scope.orgId, communityId, spaceId, actor(scope))
134
+ call: ({ communityId, spaceId }, { container, caller }) => container.content.deleteSpace(communityId, spaceId, caller.actor)
148
135
  }),
149
136
  defineTool({
150
137
  name: "delete_community",
151
138
  title: "Delete community",
152
139
  description: "Permanently delete a community with its spaces. Links to it from other spaces are removed.",
153
- scope: "communities:delete",
154
140
  kind: "destructive",
155
141
  idempotent: true,
156
142
  openWorld: false,
157
143
  input: CommunityIdParam,
158
- call: ({ communityId }, { container, scope }) => container.content.deleteCommunity(scope.orgId, communityId, actor(scope))
144
+ call: ({ communityId }, { container, caller }) => container.content.deleteCommunity(communityId, caller.actor)
159
145
  }),
160
146
  defineTool({
161
147
  name: "get_community_analytics",
162
148
  title: "Get community analytics",
163
149
  description: "Membership, activity and moderation counts for one community.",
164
- scope: "analytics:read",
165
150
  kind: "read",
166
151
  idempotent: true,
167
152
  openWorld: false,
168
153
  input: CommunityIdParam,
169
- call: ({ communityId }, { container, scope }) => container.reporting.admin.communityAnalytics(scope.orgId, communityId)
154
+ call: ({ communityId }, { container, caller }) => container.reporting.admin.communityAnalytics(communityId, caller.actor)
170
155
  })
171
156
  ];
172
157
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"communities.js","names":[],"sources":["../../../../src/http/mcp/tools/communities.ts"],"sourcesContent":["import {\n CommunitiesQuery,\n CommunityIdParam,\n CommunitySpaceParam,\n CreateCommunity,\n CreateSpace,\n OrderedIds,\n PatchDmSettings,\n SetSpaceTopics,\n SpaceLinkBody,\n SpaceLinkParam,\n UpdateCommunity,\n UpdateSpace,\n} from '../../schemas/index.js';\nimport { actor, defineTool, type Tool } from '../tool.js';\n\nexport const communityTools: Tool[] = [\n defineTool({\n name: 'list_communities',\n title: 'List communities',\n description:\n 'Search and page through the communities, drafts included, each with its status and direct-message settings. Filter by status, search by title.',\n scope: 'communities:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunitiesQuery,\n call: (input, { container, scope }) => container.content.listCommunities(scope.orgId, input),\n }),\n defineTool({\n name: 'list_spaces',\n title: 'List spaces',\n description:\n 'The spaces of a community, in order, each with its access rule, topics and links.',\n scope: 'communities:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunityIdParam,\n call: ({ communityId }, { container, scope }) =>\n container.content.listSpaces(scope.orgId, communityId),\n }),\n defineTool({\n name: 'create_community',\n title: 'Create community',\n description:\n 'Create a draft community with the default direct-message settings and no spaces. Add spaces with create_space and publish it with update_community.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateCommunity,\n call: (input, { container, scope }) =>\n container.content.createCommunity(scope.orgId, input, actor(scope)),\n }),\n defineTool({\n name: 'update_community',\n title: 'Update community',\n description:\n 'Change a community title, description or cover image, or publish and unpublish it with status. The cover must be a ready image from list_media; null clears it. Fields left out stay as they are.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateCommunity.extend(CommunityIdParam.shape),\n call: ({ communityId, ...input }, { container, scope }) =>\n container.content.updateCommunity(scope.orgId, communityId, input, actor(scope)),\n }),\n defineTool({\n name: 'update_community_messaging',\n title: 'Update community messaging',\n description:\n 'Change the direct-message settings of a community: who may message whom from now on. Settings left out stay as they are.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: PatchDmSettings.extend(CommunityIdParam.shape),\n call: ({ communityId, ...input }, { container, scope }) =>\n container.content.patchCommunitySettings(scope.orgId, communityId, input, actor(scope)),\n }),\n defineTool({\n name: 'create_space',\n title: 'Create space',\n description:\n 'Add a space at the end of a community. Its access rule decides who can open it: all members, by request or by invite. A space open to all members cannot have a capacity.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateSpace.extend(CommunityIdParam.shape),\n call: ({ communityId, ...input }, { container, scope }) =>\n container.content.createSpace(scope.orgId, communityId, input, actor(scope)),\n }),\n defineTool({\n name: 'update_space',\n title: 'Update space',\n description:\n 'Change a space name, description, access rule, capacity or settings. settings merges into the current settings. Fields left out stay as they are.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateSpace.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, ...input }, { container, scope }) =>\n container.content.updateSpace(scope.orgId, communityId, spaceId, input, actor(scope)),\n }),\n defineTool({\n name: 'reorder_spaces',\n title: 'Reorder spaces',\n description:\n 'Set the space order of a community. Pass every space id of the community in the new order.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: OrderedIds.extend(CommunityIdParam.shape),\n call: ({ communityId, ids }, { container, scope }) =>\n container.content.reorderSpaces(scope.orgId, communityId, ids, actor(scope)),\n }),\n defineTool({\n name: 'set_space_topics',\n title: 'Set space topics',\n description:\n 'Replace the topics of a space. An entry with an id keeps and renames that topic, one without adds a topic, and a topic left out is deleted. A topic that posts use cannot be deleted.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: SetSpaceTopics.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, ...input }, { container, scope }) =>\n container.content.setSpaceTopics(scope.orgId, communityId, spaceId, input, actor(scope)),\n }),\n defineTool({\n name: 'add_space_link',\n title: 'Add space link',\n description:\n 'Link a course, download or community into a space, after its other links. Returns the space.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: SpaceLinkBody.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, contentId }, { container, scope }) =>\n container.content.addSpaceLink(scope.orgId, communityId, spaceId, contentId, actor(scope)),\n }),\n defineTool({\n name: 'reorder_space_links',\n title: 'Reorder space links',\n description: 'Set the link order of a space. Pass every link id of the space in the new order.',\n scope: 'communities:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: OrderedIds.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, ids }, { container, scope }) =>\n container.content.reorderSpaceLinks(scope.orgId, communityId, spaceId, ids, actor(scope)),\n }),\n defineTool({\n name: 'remove_space_link',\n title: 'Remove space link',\n description:\n 'Take a link out of a space. The linked content itself is kept. Returns the space.',\n scope: 'communities:write',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: SpaceLinkParam,\n call: ({ communityId, spaceId, linkId }, { container, scope }) =>\n container.content.removeSpaceLink(scope.orgId, communityId, spaceId, linkId, actor(scope)),\n }),\n defineTool({\n name: 'delete_space',\n title: 'Delete space',\n description: 'Permanently delete a space with its posts, comments and members.',\n scope: 'communities:delete',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunitySpaceParam,\n call: ({ communityId, spaceId }, { container, scope }) =>\n container.content.deleteSpace(scope.orgId, communityId, spaceId, actor(scope)),\n }),\n defineTool({\n name: 'delete_community',\n title: 'Delete community',\n description:\n 'Permanently delete a community with its spaces. Links to it from other spaces are removed.',\n scope: 'communities:delete',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunityIdParam,\n call: ({ communityId }, { container, scope }) =>\n container.content.deleteCommunity(scope.orgId, communityId, actor(scope)),\n }),\n defineTool({\n name: 'get_community_analytics',\n title: 'Get community analytics',\n description: 'Membership, activity and moderation counts for one community.',\n scope: 'analytics:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunityIdParam,\n call: ({ communityId }, { container, scope }) =>\n container.reporting.admin.communityAnalytics(scope.orgId, communityId),\n }),\n];\n"],"mappings":";;;;AAgBA,MAAa,iBAAyB;CACpC,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;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AU,QAAQ,kBAAkB,MAAM,OAAO,aAAa,SAAS,KAAK,MAAM,KAAK,CAAC;CAC5F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,SAAS,UAAU,EAAE,WAAW,YACpD,UAAU,QAAQ,gBAAgB,MAAM,OAAO,aAAa,SAAS,QAAQ,MAAM,KAAK,CAAC;CAC7F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,WAAW,EAAE,WAAW,YAC5C,UAAU,QAAQ,YAAY,MAAM,OAAO,aAAa,SAAS,MAAM,KAAK,CAAC;CACjF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,eAAe,EAAE,WAAW,YACnC,UAAU,QAAQ,gBAAgB,MAAM,OAAO,aAAa,MAAM,KAAK,CAAC;CAC5E,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,eAAe,EAAE,WAAW,YACnC,UAAU,UAAU,MAAM,mBAAmB,MAAM,OAAO,WAAW;CACzE,CAAC;AACH"}
1
+ {"version":3,"file":"communities.js","names":[],"sources":["../../../../src/http/mcp/tools/communities.ts"],"sourcesContent":["import {\n CommunitiesQuery,\n CommunityIdParam,\n CommunitySpaceParam,\n CreateCommunity,\n CreateSpace,\n OrderedIds,\n PatchDmSettings,\n SetSpaceTopics,\n SpaceLinkBody,\n SpaceLinkParam,\n UpdateCommunity,\n UpdateSpace,\n} from '../../schemas/index.js';\nimport { defineTool, type Tool } from '../tool.js';\n\nexport const communityTools: Tool[] = [\n defineTool({\n name: 'list_communities',\n title: 'List communities',\n description:\n 'Search and page through the communities, drafts included, each with its status and direct-message settings. Filter by status, search by title.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunitiesQuery,\n call: (input, { container, caller }) => container.content.listCommunities(input, caller.actor),\n }),\n defineTool({\n name: 'list_spaces',\n title: 'List spaces',\n description:\n 'The spaces of a community, in order, each with its access rule, topics and links.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunityIdParam,\n call: ({ communityId }, { container, caller }) =>\n container.content.listSpaces(communityId, caller.actor),\n }),\n defineTool({\n name: 'create_community',\n title: 'Create community',\n description:\n 'Create a draft community with the default direct-message settings and no spaces. Add spaces with create_space and publish it with update_community.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateCommunity,\n call: (input, { container, caller }) => container.content.createCommunity(input, caller.actor),\n }),\n defineTool({\n name: 'update_community',\n title: 'Update community',\n description:\n 'Change a community title, description or cover image, or publish and unpublish it with status. The cover must be a ready image from list_media; null clears it. Fields left out stay as they are.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateCommunity.extend(CommunityIdParam.shape),\n call: ({ communityId, ...input }, { container, caller }) =>\n container.content.updateCommunity(communityId, input, caller.actor),\n }),\n defineTool({\n name: 'update_community_messaging',\n title: 'Update community messaging',\n description:\n 'Change the direct-message settings of a community: who may message whom from now on. Settings left out stay as they are.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: PatchDmSettings.extend(CommunityIdParam.shape),\n call: ({ communityId, ...input }, { container, caller }) =>\n container.content.patchCommunitySettings(communityId, input, caller.actor),\n }),\n defineTool({\n name: 'create_space',\n title: 'Create space',\n description:\n 'Add a space at the end of a community. Its access rule decides who can open it: all members, by request or by invite. A space open to all members cannot have a capacity.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateSpace.extend(CommunityIdParam.shape),\n call: ({ communityId, ...input }, { container, caller }) =>\n container.content.createSpace(communityId, input, caller.actor),\n }),\n defineTool({\n name: 'update_space',\n title: 'Update space',\n description:\n 'Change a space name, description, access rule, capacity, settings, cover, background or icon. settings merges into the current settings. Each image must be a ready image from list_media; null clears it. Fields left out stay as they are.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateSpace.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, ...input }, { container, caller }) =>\n container.content.updateSpace(communityId, spaceId, input, caller.actor),\n }),\n defineTool({\n name: 'reorder_spaces',\n title: 'Reorder spaces',\n description:\n 'Set the space order of a community. Pass every space id of the community in the new order.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: OrderedIds.extend(CommunityIdParam.shape),\n call: ({ communityId, ids }, { container, caller }) =>\n container.content.reorderSpaces(communityId, ids, caller.actor),\n }),\n defineTool({\n name: 'set_space_topics',\n title: 'Set space topics',\n description:\n 'Replace the topics of a space. An entry with an id keeps and renames that topic, one without adds a topic, and a topic left out is deleted. A topic that posts use cannot be deleted.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: SetSpaceTopics.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, ...input }, { container, caller }) =>\n container.content.setSpaceTopics(communityId, spaceId, input, caller.actor),\n }),\n defineTool({\n name: 'add_space_link',\n title: 'Add space link',\n description:\n 'Link a course, download or community into a space, after its other links. Returns the space.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: SpaceLinkBody.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, contentId }, { container, caller }) =>\n container.content.addSpaceLink(communityId, spaceId, contentId, caller.actor),\n }),\n defineTool({\n name: 'reorder_space_links',\n title: 'Reorder space links',\n description: 'Set the link order of a space. Pass every link id of the space in the new order.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: OrderedIds.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, ids }, { container, caller }) =>\n container.content.reorderSpaceLinks(communityId, spaceId, ids, caller.actor),\n }),\n defineTool({\n name: 'remove_space_link',\n title: 'Remove space link',\n description:\n 'Take a link out of a space. The linked content itself is kept. Returns the space.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: SpaceLinkParam,\n call: ({ communityId, spaceId, linkId }, { container, caller }) =>\n container.content.removeSpaceLink(communityId, spaceId, linkId, caller.actor),\n }),\n defineTool({\n name: 'delete_space',\n title: 'Delete space',\n description: 'Permanently delete a space with its posts, comments and members.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunitySpaceParam,\n call: ({ communityId, spaceId }, { container, caller }) =>\n container.content.deleteSpace(communityId, spaceId, caller.actor),\n }),\n defineTool({\n name: 'delete_community',\n title: 'Delete community',\n description:\n 'Permanently delete a community with its spaces. Links to it from other spaces are removed.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunityIdParam,\n call: ({ communityId }, { container, caller }) =>\n container.content.deleteCommunity(communityId, caller.actor),\n }),\n defineTool({\n name: 'get_community_analytics',\n title: 'Get community analytics',\n description: 'Membership, activity and moderation counts for one community.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunityIdParam,\n call: ({ communityId }, { container, caller }) =>\n container.reporting.admin.communityAnalytics(communityId, caller.actor),\n }),\n];\n"],"mappings":";;;;AAgBA,MAAa,iBAAyB;CACpC,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,aAAa,UAAU,QAAQ,gBAAgB,OAAO,OAAO,KAAK;CAC/F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,eAAe,EAAE,WAAW,aACnC,UAAU,QAAQ,WAAW,aAAa,OAAO,KAAK;CAC1D,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,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