@headless-lms/server 0.4.0 → 0.5.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 (223) 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 +16 -31
  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 +71 -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 +19 -14
  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 +211 -32
  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 +91 -44
  154. package/dist/http/schemas/community.js +21 -8
  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 +15 -5
  172. package/dist/http/schemas/files.js +10 -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/integrations.d.ts +4 -4
  177. package/dist/http/schemas/invites.d.ts +3 -47
  178. package/dist/http/schemas/invites.js +4 -25
  179. package/dist/http/schemas/invites.js.map +1 -1
  180. package/dist/http/schemas/member.d.ts +94 -7
  181. package/dist/http/schemas/member.js +7 -3
  182. package/dist/http/schemas/member.js.map +1 -1
  183. package/dist/http/schemas/members.d.ts +333 -69
  184. package/dist/http/schemas/members.js +67 -25
  185. package/dist/http/schemas/members.js.map +1 -1
  186. package/dist/http/schemas/notifications.d.ts +57 -53
  187. package/dist/http/schemas/platform.d.ts +37 -0
  188. package/dist/http/schemas/platform.js +19 -0
  189. package/dist/http/schemas/platform.js.map +1 -0
  190. package/dist/http/schemas/posts.d.ts +55 -35
  191. package/dist/http/schemas/posts.js +4 -4
  192. package/dist/http/schemas/posts.js.map +1 -1
  193. package/dist/http/schemas/profile.d.ts +1 -1
  194. package/dist/http/schemas/shared.d.ts +1 -11
  195. package/dist/http/schemas/shared.js +1 -10
  196. package/dist/http/schemas/shared.js.map +1 -1
  197. package/dist/http/schemas/students.d.ts +25 -3
  198. package/dist/http/schemas/students.js +3 -1
  199. package/dist/http/schemas/students.js.map +1 -1
  200. package/dist/http/scope.d.ts +9 -13
  201. package/dist/http/scope.js +29 -40
  202. package/dist/http/scope.js.map +1 -1
  203. package/dist/http/server.js +9 -0
  204. package/dist/http/server.js.map +1 -1
  205. package/dist/http/shutdown.d.ts +11 -0
  206. package/dist/http/shutdown.js +40 -0
  207. package/dist/http/shutdown.js.map +1 -0
  208. package/dist/http/sse.d.ts +19 -0
  209. package/dist/http/sse.js +104 -0
  210. package/dist/http/sse.js.map +1 -0
  211. package/dist/http/test-caller.d.ts +13 -0
  212. package/dist/http/test-caller.js +14 -0
  213. package/dist/http/test-caller.js.map +1 -0
  214. package/dist/http/well-known.js +2 -2
  215. package/dist/http/well-known.js.map +1 -1
  216. package/dist/index.d.ts +4 -2
  217. package/dist/index.js +4 -2
  218. package/dist/index.js.map +1 -1
  219. package/dist/packages/server/package.js +1 -1
  220. package/package.json +7 -6
  221. package/dist/http/routes/member/actor.d.ts +0 -14
  222. package/dist/http/routes/member/actor.js +0 -11
  223. package/dist/http/routes/member/actor.js.map +0 -1
@@ -2,85 +2,78 @@ import { PageQuery } from "../../schemas/shared.js";
2
2
  import { CommunityIdParam, CommunityMembersQuery, CommunitySpaceParam, SpaceMemberParam } from "../../schemas/community.js";
3
3
  import { OrgUserBody } from "../../schemas/chats.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/community-members.ts
7
7
  const communityMemberTools = [
8
8
  defineTool({
9
9
  name: "list_community_members",
10
10
  title: "List community members",
11
11
  description: "Page through everyone with active access to a community, granted directly or through a bundle. Search by name or email.",
12
- scope: "community_members:read",
13
12
  kind: "read",
14
13
  idempotent: true,
15
14
  openWorld: false,
16
15
  input: CommunityMembersQuery.extend(CommunityIdParam.shape),
17
- call: ({ communityId, ...query }, { container, scope }) => container.reporting.admin.communityMembers(scope.orgId, communityId, query)
16
+ call: ({ communityId, ...query }, { container, caller }) => container.reporting.admin.communityMembers(communityId, query, caller.actor)
18
17
  }),
19
18
  defineTool({
20
19
  name: "list_space_members",
21
20
  title: "List space members",
22
- description: "Page through a space's members, its open requests to join and its open invitations.",
23
- scope: "community_members:read",
21
+ description: "Page through the members of a space you can open. Community moderators also see its open requests to join and open invitations. People who open every space through their role are not listed.",
24
22
  kind: "read",
25
23
  idempotent: true,
26
24
  openWorld: false,
27
25
  input: PageQuery.extend(CommunitySpaceParam.shape),
28
- call: ({ communityId, spaceId, ...page }, { container, scope }) => container.entitlements.listSpaceMembers(scope.orgId, actor(scope), communityId, spaceId, page)
26
+ call: ({ communityId, spaceId, ...page }, { container, caller }) => container.entitlements.listSpaceMembers(communityId, spaceId, page, caller.actor)
29
27
  }),
30
28
  defineTool({
31
29
  name: "add_space_member",
32
30
  title: "Add space member",
33
31
  description: "Place a member of the community straight into a space, with no request or invitation. Not for a space open to all members, or one that is full.",
34
- scope: "community_members:write",
35
32
  kind: "write",
36
33
  idempotent: false,
37
34
  openWorld: false,
38
35
  input: OrgUserBody.extend(CommunitySpaceParam.shape),
39
- call: ({ communityId, spaceId, orgUserId }, { container, scope }) => container.entitlements.addSpaceMember(scope.orgId, actor(scope), communityId, spaceId, orgUserId)
36
+ call: ({ communityId, spaceId, orgUserId }, { container, caller }) => container.entitlements.addSpaceMember(communityId, spaceId, orgUserId, caller.actor)
40
37
  }),
41
38
  defineTool({
42
39
  name: "invite_space_member",
43
40
  title: "Invite space member",
44
41
  description: "Invite a member of the community into an invite-only space. They are notified and join when they accept.",
45
- scope: "community_members:write",
46
42
  kind: "write",
47
43
  idempotent: false,
48
44
  openWorld: true,
49
45
  input: OrgUserBody.extend(CommunitySpaceParam.shape),
50
- call: ({ communityId, spaceId, orgUserId }, { container, scope }) => container.entitlements.invite(scope.orgId, actor(scope), communityId, spaceId, orgUserId)
46
+ call: ({ communityId, spaceId, orgUserId }, { container, caller }) => container.entitlements.invite(communityId, spaceId, orgUserId, caller.actor)
51
47
  }),
52
48
  defineTool({
53
49
  name: "approve_space_request",
54
50
  title: "Approve space request",
55
51
  description: "Approve a person's request to join a space. Not when the space is full.",
56
- scope: "community_members:write",
57
52
  kind: "write",
58
53
  idempotent: true,
59
54
  openWorld: false,
60
55
  input: SpaceMemberParam,
61
- call: ({ communityId, spaceId, orgUserId }, { container, scope }) => container.entitlements.approve(scope.orgId, actor(scope), communityId, spaceId, orgUserId)
56
+ call: ({ communityId, spaceId, orgUserId }, { container, caller }) => container.entitlements.approve(communityId, spaceId, orgUserId, caller.actor)
62
57
  }),
63
58
  defineTool({
64
59
  name: "decline_space_request",
65
60
  title: "Decline space request",
66
61
  description: "Decline a person's request to join a space.",
67
- scope: "community_members:write",
68
62
  kind: "write",
69
63
  idempotent: true,
70
64
  openWorld: false,
71
65
  input: SpaceMemberParam,
72
- call: ({ communityId, spaceId, orgUserId }, { container, scope }) => container.entitlements.decline(scope.orgId, actor(scope), communityId, spaceId, orgUserId)
66
+ call: ({ communityId, spaceId, orgUserId }, { container, caller }) => container.entitlements.decline(communityId, spaceId, orgUserId, caller.actor)
73
67
  }),
74
68
  defineTool({
75
69
  name: "remove_space_member",
76
70
  title: "Remove space member",
77
71
  description: "Remove a person from a space, whether they are a member, asked to join or were invited. Their access to the community stays. Not for a space open to all members.",
78
- scope: "community_members:write",
79
72
  kind: "destructive",
80
73
  idempotent: true,
81
74
  openWorld: false,
82
75
  input: SpaceMemberParam,
83
- call: ({ communityId, spaceId, orgUserId }, { container, scope }) => container.entitlements.remove(scope.orgId, actor(scope), communityId, spaceId, orgUserId)
76
+ call: ({ communityId, spaceId, orgUserId }, { container, caller }) => container.entitlements.remove(communityId, spaceId, orgUserId, caller.actor)
84
77
  })
85
78
  ];
86
79
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"community-members.js","names":[],"sources":["../../../../src/http/mcp/tools/community-members.ts"],"sourcesContent":["import {\n CommunityIdParam,\n CommunityMembersQuery,\n CommunitySpaceParam,\n OrgUserBody,\n PageQuery,\n SpaceMemberParam,\n} from '../../schemas/index.js';\nimport { actor, defineTool, type Tool } from '../tool.js';\n\nexport const communityMemberTools: Tool[] = [\n defineTool({\n name: 'list_community_members',\n title: 'List community members',\n description:\n 'Page through everyone with active access to a community, granted directly or through a bundle. Search by name or email.',\n scope: 'community_members:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunityMembersQuery.extend(CommunityIdParam.shape),\n call: ({ communityId, ...query }, { container, scope }) =>\n container.reporting.admin.communityMembers(scope.orgId, communityId, query),\n }),\n defineTool({\n name: 'list_space_members',\n title: 'List space members',\n description:\n \"Page through a space's members, its open requests to join and its open invitations.\",\n scope: 'community_members:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: PageQuery.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, ...page }, { container, scope }) =>\n container.entitlements.listSpaceMembers(\n scope.orgId,\n actor(scope),\n communityId,\n spaceId,\n page,\n ),\n }),\n defineTool({\n name: 'add_space_member',\n title: 'Add space member',\n description:\n 'Place a member of the community straight into a space, with no request or invitation. Not for a space open to all members, or one that is full.',\n scope: 'community_members:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: OrgUserBody.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, orgUserId }, { container, scope }) =>\n container.entitlements.addSpaceMember(\n scope.orgId,\n actor(scope),\n communityId,\n spaceId,\n orgUserId,\n ),\n }),\n defineTool({\n name: 'invite_space_member',\n title: 'Invite space member',\n description:\n 'Invite a member of the community into an invite-only space. They are notified and join when they accept.',\n scope: 'community_members:write',\n kind: 'write',\n idempotent: false,\n openWorld: true,\n input: OrgUserBody.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, orgUserId }, { container, scope }) =>\n container.entitlements.invite(scope.orgId, actor(scope), communityId, spaceId, orgUserId),\n }),\n defineTool({\n name: 'approve_space_request',\n title: 'Approve space request',\n description: \"Approve a person's request to join a space. Not when the space is full.\",\n scope: 'community_members:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: SpaceMemberParam,\n call: ({ communityId, spaceId, orgUserId }, { container, scope }) =>\n container.entitlements.approve(scope.orgId, actor(scope), communityId, spaceId, orgUserId),\n }),\n defineTool({\n name: 'decline_space_request',\n title: 'Decline space request',\n description: \"Decline a person's request to join a space.\",\n scope: 'community_members:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: SpaceMemberParam,\n call: ({ communityId, spaceId, orgUserId }, { container, scope }) =>\n container.entitlements.decline(scope.orgId, actor(scope), communityId, spaceId, orgUserId),\n }),\n defineTool({\n name: 'remove_space_member',\n title: 'Remove space member',\n description:\n 'Remove a person from a space, whether they are a member, asked to join or were invited. Their access to the community stays. Not for a space open to all members.',\n scope: 'community_members:write',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: SpaceMemberParam,\n call: ({ communityId, spaceId, orgUserId }, { container, scope }) =>\n container.entitlements.remove(scope.orgId, actor(scope), communityId, spaceId, orgUserId),\n }),\n];\n"],"mappings":";;;;;;AAUA,MAAa,uBAA+B;CAC1C,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,sBAAsB,OAAO,iBAAiB,KAAK;EAC1D,OAAO,EAAE,aAAa,GAAG,SAAS,EAAE,WAAW,YAC7C,UAAU,UAAU,MAAM,iBAAiB,MAAM,OAAO,aAAa,KAAK;CAC9E,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,UAAU,OAAO,oBAAoB,KAAK;EACjD,OAAO,EAAE,aAAa,SAAS,GAAG,QAAQ,EAAE,WAAW,YACrD,UAAU,aAAa,iBACrB,MAAM,OACN,MAAM,KAAK,GACX,aACA,SACA,IACF;CACJ,CAAC;CACD,WAAW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":["../../../../src/http/mcp/tools/community-members.ts"],"sourcesContent":["import {\n CommunityIdParam,\n CommunityMembersQuery,\n CommunitySpaceParam,\n OrgUserBody,\n PageQuery,\n SpaceMemberParam,\n} from '../../schemas/index.js';\nimport { defineTool, type Tool } from '../tool.js';\n\nexport const communityMemberTools: Tool[] = [\n defineTool({\n name: 'list_community_members',\n title: 'List community members',\n description:\n 'Page through everyone with active access to a community, granted directly or through a bundle. Search by name or email.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunityMembersQuery.extend(CommunityIdParam.shape),\n call: ({ communityId, ...query }, { container, caller }) =>\n container.reporting.admin.communityMembers(communityId, query, caller.actor),\n }),\n defineTool({\n name: 'list_space_members',\n title: 'List space members',\n description:\n 'Page through the members of a space you can open. Community moderators also see its open requests to join and open invitations. People who open every space through their role are not listed.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: PageQuery.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, ...page }, { container, caller }) =>\n container.entitlements.listSpaceMembers(communityId, spaceId, page, caller.actor),\n }),\n defineTool({\n name: 'add_space_member',\n title: 'Add space member',\n description:\n 'Place a member of the community straight into a space, with no request or invitation. Not for a space open to all members, or one that is full.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: OrgUserBody.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, orgUserId }, { container, caller }) =>\n container.entitlements.addSpaceMember(communityId, spaceId, orgUserId, caller.actor),\n }),\n defineTool({\n name: 'invite_space_member',\n title: 'Invite space member',\n description:\n 'Invite a member of the community into an invite-only space. They are notified and join when they accept.',\n kind: 'write',\n idempotent: false,\n openWorld: true,\n input: OrgUserBody.extend(CommunitySpaceParam.shape),\n call: ({ communityId, spaceId, orgUserId }, { container, caller }) =>\n container.entitlements.invite(communityId, spaceId, orgUserId, caller.actor),\n }),\n defineTool({\n name: 'approve_space_request',\n title: 'Approve space request',\n description: \"Approve a person's request to join a space. Not when the space is full.\",\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: SpaceMemberParam,\n call: ({ communityId, spaceId, orgUserId }, { container, caller }) =>\n container.entitlements.approve(communityId, spaceId, orgUserId, caller.actor),\n }),\n defineTool({\n name: 'decline_space_request',\n title: 'Decline space request',\n description: \"Decline a person's request to join a space.\",\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: SpaceMemberParam,\n call: ({ communityId, spaceId, orgUserId }, { container, caller }) =>\n container.entitlements.decline(communityId, spaceId, orgUserId, caller.actor),\n }),\n defineTool({\n name: 'remove_space_member',\n title: 'Remove space member',\n description:\n 'Remove a person from a space, whether they are a member, asked to join or were invited. Their access to the community stays. Not for a space open to all members.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: SpaceMemberParam,\n call: ({ communityId, spaceId, orgUserId }, { container, caller }) =>\n container.entitlements.remove(communityId, spaceId, orgUserId, caller.actor),\n }),\n];\n"],"mappings":";;;;;;AAUA,MAAa,uBAA+B;CAC1C,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,sBAAsB,OAAO,iBAAiB,KAAK;EAC1D,OAAO,EAAE,aAAa,GAAG,SAAS,EAAE,WAAW,aAC7C,UAAU,UAAU,MAAM,iBAAiB,aAAa,OAAO,OAAO,KAAK;CAC/E,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,UAAU,OAAO,oBAAoB,KAAK;EACjD,OAAO,EAAE,aAAa,SAAS,GAAG,QAAQ,EAAE,WAAW,aACrD,UAAU,aAAa,iBAAiB,aAAa,SAAS,MAAM,OAAO,KAAK;CACpF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,YAAY,OAAO,oBAAoB,KAAK;EACnD,OAAO,EAAE,aAAa,SAAS,aAAa,EAAE,WAAW,aACvD,UAAU,aAAa,eAAe,aAAa,SAAS,WAAW,OAAO,KAAK;CACvF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,YAAY,OAAO,oBAAoB,KAAK;EACnD,OAAO,EAAE,aAAa,SAAS,aAAa,EAAE,WAAW,aACvD,UAAU,aAAa,OAAO,aAAa,SAAS,WAAW,OAAO,KAAK;CAC/E,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,SAAS,aAAa,EAAE,WAAW,aACvD,UAAU,aAAa,QAAQ,aAAa,SAAS,WAAW,OAAO,KAAK;CAChF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,SAAS,aAAa,EAAE,WAAW,aACvD,UAAU,aAAa,QAAQ,aAAa,SAAS,WAAW,OAAO,KAAK;CAChF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,SAAS,aAAa,EAAE,WAAW,aACvD,UAAU,aAAa,OAAO,aAAa,SAAS,WAAW,OAAO,KAAK;CAC/E,CAAC;AACH"}
@@ -2,140 +2,128 @@ import { CommunityChatParam, CommunityCommentParam, CommunityIdParam, CommunityM
2
2
  import { ResolvePostFlags } from "../../schemas/posts.js";
3
3
  import { ResolveMessageFlags } from "../../schemas/chats.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/community-moderation.ts
7
7
  const communityModerationTools = [
8
8
  defineTool({
9
9
  name: "get_space_moderation_queue",
10
10
  title: "Get space moderation queue",
11
11
  description: "The posts awaiting review in a space and the open flags on its posts and comments. Each list holds at most the 100 oldest; working the queue brings in the next ones.",
12
- scope: "community_moderation:read",
13
12
  kind: "read",
14
13
  idempotent: true,
15
14
  openWorld: false,
16
15
  input: CommunitySpaceParam,
17
- call: ({ communityId, spaceId }, { container, scope }) => container.posts.moderationQueue(scope.orgId, actor(scope), communityId, spaceId)
16
+ call: ({ communityId, spaceId }, { container, caller }) => container.posts.moderationQueue(communityId, spaceId, caller.actor)
18
17
  }),
19
18
  defineTool({
20
19
  name: "get_message_moderation_queue",
21
20
  title: "Get message moderation queue",
22
21
  description: "The messages in a community's chats with open flags, with the flags and the chat each is in. Holds at most the 100 oldest open flags.",
23
- scope: "community_moderation:read",
24
22
  kind: "read",
25
23
  idempotent: true,
26
24
  openWorld: false,
27
25
  input: CommunityIdParam,
28
- call: ({ communityId }, { container, scope }) => container.chats.messageQueue(scope.orgId, actor(scope), communityId)
26
+ call: ({ communityId }, { container, caller }) => container.chats.messageQueue(communityId, caller.actor)
29
27
  }),
30
28
  defineTool({
31
29
  name: "approve_post",
32
30
  title: "Approve post",
33
31
  description: "Publish a post that is awaiting review.",
34
- scope: "community_moderation:write",
35
32
  kind: "write",
36
33
  idempotent: true,
37
34
  openWorld: false,
38
35
  input: CommunityPostParam,
39
- call: ({ communityId, postId }, { container, scope }) => container.posts.approve(scope.orgId, postId, actor(scope), communityId)
36
+ call: ({ communityId, postId }, { container, caller }) => container.posts.approve(postId, communityId, caller.actor)
40
37
  }),
41
38
  defineTool({
42
39
  name: "dismiss_post_flags",
43
40
  title: "Dismiss post flags",
44
41
  description: "Close every open flag on a post and leave it up.",
45
- scope: "community_moderation:write",
46
42
  kind: "write",
47
43
  idempotent: true,
48
44
  openWorld: false,
49
45
  input: ResolvePostFlags.extend(CommunityPostParam.shape),
50
- call: ({ communityId, postId, resolution }, { container, scope }) => container.posts.resolveFlags(scope.orgId, postId, actor(scope), resolution, communityId)
46
+ call: ({ communityId, postId, resolution }, { container, caller }) => container.posts.resolveFlags(postId, resolution, communityId, caller.actor)
51
47
  }),
52
48
  defineTool({
53
49
  name: "remove_post",
54
50
  title: "Remove post",
55
51
  description: "Take a published or pending post down and resolve its open flags as removed. restore_post brings it back.",
56
- scope: "community_moderation:write",
57
52
  kind: "destructive",
58
53
  idempotent: true,
59
54
  openWorld: false,
60
55
  input: CommunityPostParam,
61
- call: ({ communityId, postId }, { container, scope }) => container.posts.remove(scope.orgId, postId, actor(scope), communityId)
56
+ call: ({ communityId, postId }, { container, caller }) => container.posts.remove(postId, communityId, caller.actor)
62
57
  }),
63
58
  defineTool({
64
59
  name: "restore_post",
65
60
  title: "Restore post",
66
61
  description: "Put a removed post back up.",
67
- scope: "community_moderation:write",
68
62
  kind: "write",
69
63
  idempotent: true,
70
64
  openWorld: false,
71
65
  input: CommunityPostParam,
72
- call: ({ communityId, postId }, { container, scope }) => container.posts.restore(scope.orgId, postId, actor(scope), communityId)
66
+ call: ({ communityId, postId }, { container, caller }) => container.posts.restore(postId, communityId, caller.actor)
73
67
  }),
74
68
  defineTool({
75
69
  name: "dismiss_post_comment_flags",
76
70
  title: "Dismiss post comment flags",
77
71
  description: "Close every open flag on a comment on a post and leave it up.",
78
- scope: "community_moderation:write",
79
72
  kind: "write",
80
73
  idempotent: true,
81
74
  openWorld: false,
82
75
  input: CommunityCommentParam,
83
- call: ({ communityId, commentId }, { container, scope }) => container.discussion.resolveReports(scope.orgId, commentId, actor(scope), communityId)
76
+ call: ({ communityId, commentId }, { container, caller }) => container.discussion.resolveReports(commentId, { communityId }, caller.actor)
84
77
  }),
85
78
  defineTool({
86
79
  name: "remove_post_comment",
87
80
  title: "Remove post comment",
88
81
  description: "Hide a comment on a post and resolve its open flags as removed. restore_post_comment brings it back.",
89
- scope: "community_moderation:write",
90
82
  kind: "destructive",
91
83
  idempotent: true,
92
84
  openWorld: false,
93
85
  input: CommunityCommentParam,
94
- call: ({ communityId, commentId }, { container, scope }) => container.discussion.remove(scope.orgId, commentId, actor(scope), communityId)
86
+ call: ({ communityId, commentId }, { container, caller }) => container.discussion.remove(commentId, { communityId }, caller.actor)
95
87
  }),
96
88
  defineTool({
97
89
  name: "restore_post_comment",
98
90
  title: "Restore post comment",
99
91
  description: "Publish a removed comment on a post again.",
100
- scope: "community_moderation:write",
101
92
  kind: "write",
102
93
  idempotent: true,
103
94
  openWorld: false,
104
95
  input: CommunityCommentParam,
105
- call: ({ communityId, commentId }, { container, scope }) => container.discussion.restore(scope.orgId, commentId, actor(scope), communityId)
96
+ call: ({ communityId, commentId }, { container, caller }) => container.discussion.restore(commentId, { communityId }, caller.actor)
106
97
  }),
107
98
  defineTool({
108
99
  name: "dismiss_message_flags",
109
100
  title: "Dismiss message flags",
110
101
  description: "Close every open flag on a chat message and leave it up.",
111
- scope: "community_moderation:write",
112
102
  kind: "write",
113
103
  idempotent: true,
114
104
  openWorld: false,
115
105
  input: ResolveMessageFlags.extend(CommunityMessageParam.shape),
116
- call: ({ communityId, messageId, resolution }, { container, scope }) => container.chats.resolveMessageFlags(scope.orgId, actor(scope), messageId, resolution, communityId)
106
+ call: ({ communityId, messageId, resolution }, { container, caller }) => container.chats.resolveMessageFlags(messageId, resolution, communityId, caller.actor)
117
107
  }),
118
108
  defineTool({
119
109
  name: "lock_chat",
120
110
  title: "Lock chat",
121
111
  description: "Stop everyone sending or editing messages in a chat until it is unlocked. Its open message flags are resolved as locked.",
122
- scope: "community_moderation:write",
123
112
  kind: "destructive",
124
113
  idempotent: true,
125
114
  openWorld: false,
126
115
  input: CommunityChatParam,
127
- call: ({ communityId, chatId }, { container, scope }) => container.chats.lock(scope.orgId, actor(scope), chatId, communityId)
116
+ call: ({ communityId, chatId }, { container, caller }) => container.chats.lock(chatId, communityId, caller.actor)
128
117
  }),
129
118
  defineTool({
130
119
  name: "unlock_chat",
131
120
  title: "Unlock chat",
132
121
  description: "Let the participants of a locked chat send messages again.",
133
- scope: "community_moderation:write",
134
122
  kind: "write",
135
123
  idempotent: true,
136
124
  openWorld: false,
137
125
  input: CommunityChatParam,
138
- call: ({ communityId, chatId }, { container, scope }) => container.chats.unlock(scope.orgId, actor(scope), chatId, communityId)
126
+ call: ({ communityId, chatId }, { container, caller }) => container.chats.unlock(chatId, communityId, caller.actor)
139
127
  })
140
128
  ];
141
129
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"community-moderation.js","names":[],"sources":["../../../../src/http/mcp/tools/community-moderation.ts"],"sourcesContent":["import {\n CommunityChatParam,\n CommunityCommentParam,\n CommunityIdParam,\n CommunityMessageParam,\n CommunityPostParam,\n CommunitySpaceParam,\n ResolveMessageFlags,\n ResolvePostFlags,\n} from '../../schemas/index.js';\nimport { actor, defineTool, type Tool } from '../tool.js';\n\nexport const communityModerationTools: Tool[] = [\n defineTool({\n name: 'get_space_moderation_queue',\n title: 'Get space moderation queue',\n description:\n 'The posts awaiting review in a space and the open flags on its posts and comments. Each list holds at most the 100 oldest; working the queue brings in the next ones.',\n scope: 'community_moderation:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunitySpaceParam,\n call: ({ communityId, spaceId }, { container, scope }) =>\n container.posts.moderationQueue(scope.orgId, actor(scope), communityId, spaceId),\n }),\n defineTool({\n name: 'get_message_moderation_queue',\n title: 'Get message moderation queue',\n description:\n \"The messages in a community's chats with open flags, with the flags and the chat each is in. Holds at most the 100 oldest open flags.\",\n scope: 'community_moderation:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunityIdParam,\n call: ({ communityId }, { container, scope }) =>\n container.chats.messageQueue(scope.orgId, actor(scope), communityId),\n }),\n defineTool({\n name: 'approve_post',\n title: 'Approve post',\n description: 'Publish a post that is awaiting review.',\n scope: 'community_moderation:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityPostParam,\n call: ({ communityId, postId }, { container, scope }) =>\n container.posts.approve(scope.orgId, postId, actor(scope), communityId),\n }),\n defineTool({\n name: 'dismiss_post_flags',\n title: 'Dismiss post flags',\n description: 'Close every open flag on a post and leave it up.',\n scope: 'community_moderation:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ResolvePostFlags.extend(CommunityPostParam.shape),\n call: ({ communityId, postId, resolution }, { container, scope }) =>\n container.posts.resolveFlags(scope.orgId, postId, actor(scope), resolution, communityId),\n }),\n defineTool({\n name: 'remove_post',\n title: 'Remove post',\n description:\n 'Take a published or pending post down and resolve its open flags as removed. restore_post brings it back.',\n scope: 'community_moderation:write',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunityPostParam,\n call: ({ communityId, postId }, { container, scope }) =>\n container.posts.remove(scope.orgId, postId, actor(scope), communityId),\n }),\n defineTool({\n name: 'restore_post',\n title: 'Restore post',\n description: 'Put a removed post back up.',\n scope: 'community_moderation:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityPostParam,\n call: ({ communityId, postId }, { container, scope }) =>\n container.posts.restore(scope.orgId, postId, actor(scope), communityId),\n }),\n defineTool({\n name: 'dismiss_post_comment_flags',\n title: 'Dismiss post comment flags',\n description: 'Close every open flag on a comment on a post and leave it up.',\n scope: 'community_moderation:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityCommentParam,\n call: ({ communityId, commentId }, { container, scope }) =>\n container.discussion.resolveReports(scope.orgId, commentId, actor(scope), communityId),\n }),\n defineTool({\n name: 'remove_post_comment',\n title: 'Remove post comment',\n description:\n 'Hide a comment on a post and resolve its open flags as removed. restore_post_comment brings it back.',\n scope: 'community_moderation:write',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunityCommentParam,\n call: ({ communityId, commentId }, { container, scope }) =>\n container.discussion.remove(scope.orgId, commentId, actor(scope), communityId),\n }),\n defineTool({\n name: 'restore_post_comment',\n title: 'Restore post comment',\n description: 'Publish a removed comment on a post again.',\n scope: 'community_moderation:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityCommentParam,\n call: ({ communityId, commentId }, { container, scope }) =>\n container.discussion.restore(scope.orgId, commentId, actor(scope), communityId),\n }),\n defineTool({\n name: 'dismiss_message_flags',\n title: 'Dismiss message flags',\n description: 'Close every open flag on a chat message and leave it up.',\n scope: 'community_moderation:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ResolveMessageFlags.extend(CommunityMessageParam.shape),\n call: ({ communityId, messageId, resolution }, { container, scope }) =>\n container.chats.resolveMessageFlags(\n scope.orgId,\n actor(scope),\n messageId,\n resolution,\n communityId,\n ),\n }),\n defineTool({\n name: 'lock_chat',\n title: 'Lock chat',\n description:\n 'Stop everyone sending or editing messages in a chat until it is unlocked. Its open message flags are resolved as locked.',\n scope: 'community_moderation:write',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunityChatParam,\n call: ({ communityId, chatId }, { container, scope }) =>\n container.chats.lock(scope.orgId, actor(scope), chatId, communityId),\n }),\n defineTool({\n name: 'unlock_chat',\n title: 'Unlock chat',\n description: 'Let the participants of a locked chat send messages again.',\n scope: 'community_moderation:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityChatParam,\n call: ({ communityId, chatId }, { container, scope }) =>\n container.chats.unlock(scope.orgId, actor(scope), chatId, communityId),\n }),\n];\n"],"mappings":";;;;;;AAYA,MAAa,2BAAmC;CAC9C,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,WAAW,EAAE,WAAW,YAC5C,UAAU,MAAM,gBAAgB,MAAM,OAAO,MAAM,KAAK,GAAG,aAAa,OAAO;CACnF,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,MAAM,aAAa,MAAM,OAAO,MAAM,KAAK,GAAG,WAAW;CACvE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;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a,aAAa,EAAE,WAAW,YAC9C,UAAU,WAAW,OAAO,MAAM,OAAO,WAAW,MAAM,KAAK,GAAG,WAAW;CACjF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,aAAa,EAAE,WAAW,YAC9C,UAAU,WAAW,QAAQ,MAAM,OAAO,WAAW,MAAM,KAAK,GAAG,WAAW;CAClF,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,oBAAoB,OAAO,sBAAsB,KAAK;EAC7D,OAAO,EAAE,aAAa,WAAW,cAAc,EAAE,WAAW,YAC1D,UAAU,MAAM,oBACd,MAAM,OACN,MAAM,KAAK,GACX,WACA,YACA,WACF;CACJ,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,UAAU,EAAE,WAAW,YAC3C,UAAU,MAAM,KAAK,MAAM,OAAO,MAAM,KAAK,GAAG,QAAQ,WAAW;CACvE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,aAAa,UAAU,EAAE,WAAW,YAC3C,UAAU,MAAM,OAAO,MAAM,OAAO,MAAM,KAAK,GAAG,QAAQ,WAAW;CACzE,CAAC;AACH"}
1
+ {"version":3,"file":"community-moderation.js","names":[],"sources":["../../../../src/http/mcp/tools/community-moderation.ts"],"sourcesContent":["import {\n CommunityChatParam,\n CommunityCommentParam,\n CommunityIdParam,\n CommunityMessageParam,\n CommunityPostParam,\n CommunitySpaceParam,\n ResolveMessageFlags,\n ResolvePostFlags,\n} from '../../schemas/index.js';\nimport { defineTool, type Tool } from '../tool.js';\n\nexport const communityModerationTools: Tool[] = [\n defineTool({\n name: 'get_space_moderation_queue',\n title: 'Get space moderation queue',\n description:\n 'The posts awaiting review in a space and the open flags on its posts and comments. Each list holds at most the 100 oldest; working the queue brings in the next ones.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunitySpaceParam,\n call: ({ communityId, spaceId }, { container, caller }) =>\n container.posts.moderationQueue(communityId, spaceId, caller.actor),\n }),\n defineTool({\n name: 'get_message_moderation_queue',\n title: 'Get message moderation queue',\n description:\n \"The messages in a community's chats with open flags, with the flags and the chat each is in. Holds at most the 100 oldest open flags.\",\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CommunityIdParam,\n call: ({ communityId }, { container, caller }) =>\n container.chats.messageQueue(communityId, caller.actor),\n }),\n defineTool({\n name: 'approve_post',\n title: 'Approve post',\n description: 'Publish a post that is awaiting review.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityPostParam,\n call: ({ communityId, postId }, { container, caller }) =>\n container.posts.approve(postId, communityId, caller.actor),\n }),\n defineTool({\n name: 'dismiss_post_flags',\n title: 'Dismiss post flags',\n description: 'Close every open flag on a post and leave it up.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ResolvePostFlags.extend(CommunityPostParam.shape),\n call: ({ communityId, postId, resolution }, { container, caller }) =>\n container.posts.resolveFlags(postId, resolution, communityId, caller.actor),\n }),\n defineTool({\n name: 'remove_post',\n title: 'Remove post',\n description:\n 'Take a published or pending post down and resolve its open flags as removed. restore_post brings it back.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunityPostParam,\n call: ({ communityId, postId }, { container, caller }) =>\n container.posts.remove(postId, communityId, caller.actor),\n }),\n defineTool({\n name: 'restore_post',\n title: 'Restore post',\n description: 'Put a removed post back up.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityPostParam,\n call: ({ communityId, postId }, { container, caller }) =>\n container.posts.restore(postId, communityId, caller.actor),\n }),\n defineTool({\n name: 'dismiss_post_comment_flags',\n title: 'Dismiss post comment flags',\n description: 'Close every open flag on a comment on a post and leave it up.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityCommentParam,\n call: ({ communityId, commentId }, { container, caller }) =>\n container.discussion.resolveReports(commentId, { communityId }, caller.actor),\n }),\n defineTool({\n name: 'remove_post_comment',\n title: 'Remove post comment',\n description:\n 'Hide a comment on a post and resolve its open flags as removed. restore_post_comment brings it back.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunityCommentParam,\n call: ({ communityId, commentId }, { container, caller }) =>\n container.discussion.remove(commentId, { communityId }, caller.actor),\n }),\n defineTool({\n name: 'restore_post_comment',\n title: 'Restore post comment',\n description: 'Publish a removed comment on a post again.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityCommentParam,\n call: ({ communityId, commentId }, { container, caller }) =>\n container.discussion.restore(commentId, { communityId }, caller.actor),\n }),\n defineTool({\n name: 'dismiss_message_flags',\n title: 'Dismiss message flags',\n description: 'Close every open flag on a chat message and leave it up.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ResolveMessageFlags.extend(CommunityMessageParam.shape),\n call: ({ communityId, messageId, resolution }, { container, caller }) =>\n container.chats.resolveMessageFlags(messageId, resolution, communityId, caller.actor),\n }),\n defineTool({\n name: 'lock_chat',\n title: 'Lock chat',\n description:\n 'Stop everyone sending or editing messages in a chat until it is unlocked. Its open message flags are resolved as locked.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CommunityChatParam,\n call: ({ communityId, chatId }, { container, caller }) =>\n container.chats.lock(chatId, communityId, caller.actor),\n }),\n defineTool({\n name: 'unlock_chat',\n title: 'Unlock chat',\n description: 'Let the participants of a locked chat send messages again.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: CommunityChatParam,\n call: ({ communityId, chatId }, { container, caller }) =>\n container.chats.unlock(chatId, communityId, caller.actor),\n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 -1,118 +1,108 @@
1
1
  import { CoursesQuery, CreateCourse, PatchCourseSettings, UpdateCourse } from "../../schemas/content.js";
2
2
  import { CourseIdPathParam, CreateModule, ModulePathParam, ReorderInput, UpdateModule } from "../../schemas/activities.js";
3
3
  import "../../schemas/index.js";
4
- import { actor, defineTool } from "../tool.js";
4
+ import { defineTool } from "../tool.js";
5
5
  //#region src/http/mcp/tools/courses.ts
6
6
  const courseTools = [
7
7
  defineTool({
8
8
  name: "list_courses",
9
9
  title: "List courses",
10
10
  description: "Search and page through the courses, each with its status and settings. Filter by status or category.",
11
- scope: "courses:read",
12
11
  kind: "read",
13
12
  idempotent: true,
14
13
  openWorld: false,
15
14
  input: CoursesQuery,
16
- call: (input, { container, scope }) => container.content.listCourses(scope.orgId, input)
15
+ call: (input, { container, caller }) => container.content.listCourses(input, caller.actor)
17
16
  }),
18
17
  defineTool({
19
18
  name: "list_modules",
20
19
  title: "List modules",
21
20
  description: "The modules of a course, in order.",
22
- scope: "courses:read",
23
21
  kind: "read",
24
22
  idempotent: true,
25
23
  openWorld: false,
26
24
  input: CourseIdPathParam,
27
- call: ({ courseId }, { container, scope }) => container.content.listCourseModules(scope.orgId, courseId)
25
+ call: ({ courseId }, { container, caller }) => container.content.listCourseModules(courseId, caller.actor)
28
26
  }),
29
27
  defineTool({
30
28
  name: "create_course",
31
29
  title: "Create course",
32
30
  description: "Create a draft course. Publish it with update_course.",
33
- scope: "courses:write",
34
31
  kind: "write",
35
32
  idempotent: false,
36
33
  openWorld: false,
37
34
  input: CreateCourse,
38
- call: (input, { container, scope }) => container.content.createCourse(scope.orgId, input)
35
+ call: (input, { container, caller }) => container.content.createCourse(input, caller.actor)
39
36
  }),
40
37
  defineTool({
41
38
  name: "update_course",
42
39
  title: "Update course",
43
40
  description: "Change a course title, description, category or cover image, or publish and unpublish it with status. Fields left out stay as they are.",
44
- scope: "courses:write",
45
41
  kind: "write",
46
42
  idempotent: true,
47
43
  openWorld: false,
48
44
  input: UpdateCourse.extend(CourseIdPathParam.shape),
49
- call: ({ courseId, ...patch }, { container, scope }) => container.content.updateCourse(scope.orgId, courseId, patch)
45
+ call: ({ courseId, ...patch }, { container, caller }) => container.content.updateCourse(courseId, patch, caller.actor)
50
46
  }),
51
47
  defineTool({
52
48
  name: "update_course_settings",
53
49
  title: "Update course settings",
54
50
  description: "Change course settings such as transcript downloads and comments. Settings left out stay as they are.",
55
- scope: "courses:write",
56
51
  kind: "write",
57
52
  idempotent: true,
58
53
  openWorld: false,
59
54
  input: PatchCourseSettings.extend(CourseIdPathParam.shape),
60
- call: ({ courseId, ...settings }, { container, scope }) => container.content.patchCourseSettings(scope.orgId, courseId, settings)
55
+ call: ({ courseId, ...settings }, { container, caller }) => container.content.patchCourseSettings(courseId, settings, caller.actor)
61
56
  }),
62
57
  defineTool({
63
58
  name: "create_module",
64
59
  title: "Create module",
65
60
  description: "Add a module at the end of a course. Returns the course modules in order.",
66
- scope: "courses:write",
67
61
  kind: "write",
68
62
  idempotent: false,
69
63
  openWorld: false,
70
64
  input: CreateModule.extend(CourseIdPathParam.shape),
71
- call: ({ courseId, title }, { container, scope }) => container.content.createModule(scope.orgId, courseId, title)
65
+ call: ({ courseId, title }, { container, caller }) => container.content.createModule(courseId, title, caller.actor)
72
66
  }),
73
67
  defineTool({
74
68
  name: "rename_module",
75
69
  title: "Rename module",
76
70
  description: "Rename a module. Returns the course modules in order.",
77
- scope: "courses:write",
78
71
  kind: "write",
79
72
  idempotent: true,
80
73
  openWorld: false,
81
74
  input: UpdateModule.extend(ModulePathParam.shape),
82
- call: ({ courseId, moduleId, title }, { container, scope }) => container.content.updateModule(scope.orgId, courseId, moduleId, title)
75
+ call: ({ courseId, moduleId, title }, { container, caller }) => container.content.updateModule(courseId, moduleId, title, caller.actor)
83
76
  }),
84
77
  defineTool({
85
78
  name: "reorder_modules",
86
79
  title: "Reorder modules",
87
80
  description: "Set the module order of a course. Pass every module id of the course in the new order.",
88
- scope: "courses:write",
89
81
  kind: "write",
90
82
  idempotent: true,
91
83
  openWorld: false,
92
84
  input: ReorderInput.extend(CourseIdPathParam.shape),
93
- call: ({ courseId, orderedIds }, { container, scope }) => container.content.reorderModules(scope.orgId, courseId, orderedIds)
85
+ call: ({ courseId, orderedIds }, { container, caller }) => container.content.reorderModules(courseId, orderedIds, caller.actor)
94
86
  }),
95
87
  defineTool({
96
88
  name: "delete_course",
97
89
  title: "Delete course",
98
90
  description: "Permanently delete a course with its modules and activities.",
99
- scope: "courses:delete",
100
91
  kind: "destructive",
101
92
  idempotent: true,
102
93
  openWorld: false,
103
94
  input: CourseIdPathParam,
104
- call: ({ courseId }, { container, scope }) => container.content.deleteCourse(scope.orgId, courseId, actor(scope))
95
+ call: ({ courseId }, { container, caller }) => container.content.deleteCourse(courseId, caller.actor)
105
96
  }),
106
97
  defineTool({
107
98
  name: "delete_module",
108
99
  title: "Delete module",
109
100
  description: "Permanently delete a module with its activities. Returns the remaining modules in order.",
110
- scope: "courses:delete",
111
101
  kind: "destructive",
112
102
  idempotent: true,
113
103
  openWorld: false,
114
104
  input: ModulePathParam,
115
- call: ({ courseId, moduleId }, { container, scope }) => container.content.deleteModule(scope.orgId, courseId, moduleId)
105
+ call: ({ courseId, moduleId }, { container, caller }) => container.content.deleteModule(courseId, moduleId, caller.actor)
116
106
  })
117
107
  ];
118
108
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"courses.js","names":[],"sources":["../../../../src/http/mcp/tools/courses.ts"],"sourcesContent":["import {\n CourseIdPathParam,\n CoursesQuery,\n CreateCourse,\n CreateModule,\n ModulePathParam,\n PatchCourseSettings,\n ReorderInput,\n UpdateCourse,\n UpdateModule,\n} from '../../schemas/index.js';\nimport { actor, defineTool, type Tool } from '../tool.js';\n\nexport const courseTools: Tool[] = [\n defineTool({\n name: 'list_courses',\n title: 'List courses',\n description:\n 'Search and page through the courses, each with its status and settings. Filter by status or category.',\n scope: 'courses:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CoursesQuery,\n call: (input, { container, scope }) => container.content.listCourses(scope.orgId, input),\n }),\n defineTool({\n name: 'list_modules',\n title: 'List modules',\n description: 'The modules of a course, in order.',\n scope: 'courses:read',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CourseIdPathParam,\n call: ({ courseId }, { container, scope }) =>\n container.content.listCourseModules(scope.orgId, courseId),\n }),\n defineTool({\n name: 'create_course',\n title: 'Create course',\n description: 'Create a draft course. Publish it with update_course.',\n scope: 'courses:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateCourse,\n call: (input, { container, scope }) => container.content.createCourse(scope.orgId, input),\n }),\n defineTool({\n name: 'update_course',\n title: 'Update course',\n description:\n 'Change a course title, description, category or cover image, or publish and unpublish it with status. Fields left out stay as they are.',\n scope: 'courses:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateCourse.extend(CourseIdPathParam.shape),\n call: ({ courseId, ...patch }, { container, scope }) =>\n container.content.updateCourse(scope.orgId, courseId, patch),\n }),\n defineTool({\n name: 'update_course_settings',\n title: 'Update course settings',\n description:\n 'Change course settings such as transcript downloads and comments. Settings left out stay as they are.',\n scope: 'courses:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: PatchCourseSettings.extend(CourseIdPathParam.shape),\n call: ({ courseId, ...settings }, { container, scope }) =>\n container.content.patchCourseSettings(scope.orgId, courseId, settings),\n }),\n defineTool({\n name: 'create_module',\n title: 'Create module',\n description: 'Add a module at the end of a course. Returns the course modules in order.',\n scope: 'courses:write',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateModule.extend(CourseIdPathParam.shape),\n call: ({ courseId, title }, { container, scope }) =>\n container.content.createModule(scope.orgId, courseId, title),\n }),\n defineTool({\n name: 'rename_module',\n title: 'Rename module',\n description: 'Rename a module. Returns the course modules in order.',\n scope: 'courses:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateModule.extend(ModulePathParam.shape),\n call: ({ courseId, moduleId, title }, { container, scope }) =>\n container.content.updateModule(scope.orgId, courseId, moduleId, title),\n }),\n defineTool({\n name: 'reorder_modules',\n title: 'Reorder modules',\n description:\n 'Set the module order of a course. Pass every module id of the course in the new order.',\n scope: 'courses:write',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ReorderInput.extend(CourseIdPathParam.shape),\n call: ({ courseId, orderedIds }, { container, scope }) =>\n container.content.reorderModules(scope.orgId, courseId, orderedIds),\n }),\n defineTool({\n name: 'delete_course',\n title: 'Delete course',\n description: 'Permanently delete a course with its modules and activities.',\n scope: 'courses:delete',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CourseIdPathParam,\n call: ({ courseId }, { container, scope }) =>\n container.content.deleteCourse(scope.orgId, courseId, actor(scope)),\n }),\n defineTool({\n name: 'delete_module',\n title: 'Delete module',\n description:\n 'Permanently delete a module with its activities. Returns the remaining modules in order.',\n scope: 'courses:delete',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: ModulePathParam,\n call: ({ courseId, moduleId }, { container, scope }) =>\n container.content.deleteModule(scope.orgId, courseId, moduleId),\n }),\n];\n"],"mappings":";;;;;AAaA,MAAa,cAAsB;CACjC,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,YAAY,MAAM,OAAO,KAAK;CACzF,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,kBAAkB,MAAM,OAAO,QAAQ;CAC7D,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,YAAY,UAAU,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ACT,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,UAAU,MAAM,KAAK,CAAC;CACtE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,OAAO;EACP,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,UAAU,YAAY,EAAE,WAAW,YAC1C,UAAU,QAAQ,aAAa,MAAM,OAAO,UAAU,QAAQ;CAClE,CAAC;AACH"}
1
+ {"version":3,"file":"courses.js","names":[],"sources":["../../../../src/http/mcp/tools/courses.ts"],"sourcesContent":["import {\n CourseIdPathParam,\n CoursesQuery,\n CreateCourse,\n CreateModule,\n ModulePathParam,\n PatchCourseSettings,\n ReorderInput,\n UpdateCourse,\n UpdateModule,\n} from '../../schemas/index.js';\nimport { defineTool, type Tool } from '../tool.js';\n\nexport const courseTools: Tool[] = [\n defineTool({\n name: 'list_courses',\n title: 'List courses',\n description:\n 'Search and page through the courses, each with its status and settings. Filter by status or category.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CoursesQuery,\n call: (input, { container, caller }) => container.content.listCourses(input, caller.actor),\n }),\n defineTool({\n name: 'list_modules',\n title: 'List modules',\n description: 'The modules of a course, in order.',\n kind: 'read',\n idempotent: true,\n openWorld: false,\n input: CourseIdPathParam,\n call: ({ courseId }, { container, caller }) =>\n container.content.listCourseModules(courseId, caller.actor),\n }),\n defineTool({\n name: 'create_course',\n title: 'Create course',\n description: 'Create a draft course. Publish it with update_course.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateCourse,\n call: (input, { container, caller }) => container.content.createCourse(input, caller.actor),\n }),\n defineTool({\n name: 'update_course',\n title: 'Update course',\n description:\n 'Change a course 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: UpdateCourse.extend(CourseIdPathParam.shape),\n call: ({ courseId, ...patch }, { container, caller }) =>\n container.content.updateCourse(courseId, patch, caller.actor),\n }),\n defineTool({\n name: 'update_course_settings',\n title: 'Update course settings',\n description:\n 'Change course settings such as transcript downloads and comments. Settings left out stay as they are.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: PatchCourseSettings.extend(CourseIdPathParam.shape),\n call: ({ courseId, ...settings }, { container, caller }) =>\n container.content.patchCourseSettings(courseId, settings, caller.actor),\n }),\n defineTool({\n name: 'create_module',\n title: 'Create module',\n description: 'Add a module at the end of a course. Returns the course modules in order.',\n kind: 'write',\n idempotent: false,\n openWorld: false,\n input: CreateModule.extend(CourseIdPathParam.shape),\n call: ({ courseId, title }, { container, caller }) =>\n container.content.createModule(courseId, title, caller.actor),\n }),\n defineTool({\n name: 'rename_module',\n title: 'Rename module',\n description: 'Rename a module. Returns the course modules in order.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: UpdateModule.extend(ModulePathParam.shape),\n call: ({ courseId, moduleId, title }, { container, caller }) =>\n container.content.updateModule(courseId, moduleId, title, caller.actor),\n }),\n defineTool({\n name: 'reorder_modules',\n title: 'Reorder modules',\n description:\n 'Set the module order of a course. Pass every module id of the course in the new order.',\n kind: 'write',\n idempotent: true,\n openWorld: false,\n input: ReorderInput.extend(CourseIdPathParam.shape),\n call: ({ courseId, orderedIds }, { container, caller }) =>\n container.content.reorderModules(courseId, orderedIds, caller.actor),\n }),\n defineTool({\n name: 'delete_course',\n title: 'Delete course',\n description: 'Permanently delete a course with its modules and activities.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: CourseIdPathParam,\n call: ({ courseId }, { container, caller }) =>\n container.content.deleteCourse(courseId, caller.actor),\n }),\n defineTool({\n name: 'delete_module',\n title: 'Delete module',\n description:\n 'Permanently delete a module with its activities. Returns the remaining modules in order.',\n kind: 'destructive',\n idempotent: true,\n openWorld: false,\n input: ModulePathParam,\n call: ({ courseId, moduleId }, { container, caller }) =>\n container.content.deleteModule(courseId, moduleId, caller.actor),\n }),\n];\n"],"mappings":";;;;;AAaA,MAAa,cAAsB;CACjC,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,aAAa,UAAU,QAAQ,YAAY,OAAO,OAAO,KAAK;CAC3F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,YAAY,EAAE,WAAW,aAChC,UAAU,QAAQ,kBAAkB,UAAU,OAAO,KAAK;CAC9D,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,OAAO,EAAE,WAAW,aAAa,UAAU,QAAQ,aAAa,OAAO,OAAO,KAAK;CAC5F,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,aAAa,OAAO,kBAAkB,KAAK;EAClD,OAAO,EAAE,UAAU,GAAG,SAAS,EAAE,WAAW,aAC1C,UAAU,QAAQ,aAAa,UAAU,OAAO,OAAO,KAAK;CAChE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,oBAAoB,OAAO,kBAAkB,KAAK;EACzD,OAAO,EAAE,UAAU,GAAG,YAAY,EAAE,WAAW,aAC7C,UAAU,QAAQ,oBAAoB,UAAU,UAAU,OAAO,KAAK;CAC1E,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,aAAa,OAAO,kBAAkB,KAAK;EAClD,OAAO,EAAE,UAAU,SAAS,EAAE,WAAW,aACvC,UAAU,QAAQ,aAAa,UAAU,OAAO,OAAO,KAAK;CAChE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,aAAa,OAAO,gBAAgB,KAAK;EAChD,OAAO,EAAE,UAAU,UAAU,SAAS,EAAE,WAAW,aACjD,UAAU,QAAQ,aAAa,UAAU,UAAU,OAAO,OAAO,KAAK;CAC1E,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO,aAAa,OAAO,kBAAkB,KAAK;EAClD,OAAO,EAAE,UAAU,cAAc,EAAE,WAAW,aAC5C,UAAU,QAAQ,eAAe,UAAU,YAAY,OAAO,KAAK;CACvE,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aAAa;EACb,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,YAAY,EAAE,WAAW,aAChC,UAAU,QAAQ,aAAa,UAAU,OAAO,KAAK;CACzD,CAAC;CACD,WAAW;EACT,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,OAAO;EACP,OAAO,EAAE,UAAU,YAAY,EAAE,WAAW,aAC1C,UAAU,QAAQ,aAAa,UAAU,UAAU,OAAO,KAAK;CACnE,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ import { Tool } from "../tool.js";
2
+ //#region src/http/mcp/tools/events.d.ts
3
+ declare const eventTools: Tool[];
4
+ //#endregion
5
+ export { eventTools };
6
+ //# sourceMappingURL=events.d.ts.map