@av-leschinskiy/moodle-mcp 0.2.0 → 0.3.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 (46) hide show
  1. package/README.md +28 -7
  2. package/dist/api/functions.d.ts +3 -0
  3. package/dist/api/functions.d.ts.map +1 -1
  4. package/dist/api/functions.js +3 -0
  5. package/dist/api/functions.js.map +1 -1
  6. package/dist/api/moodle-client.d.ts.map +1 -1
  7. package/dist/api/moodle-client.js +7 -1
  8. package/dist/api/moodle-client.js.map +1 -1
  9. package/dist/config.d.ts +3 -0
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +7 -0
  12. package/dist/config.js.map +1 -1
  13. package/dist/server.d.ts.map +1 -1
  14. package/dist/server.js +2 -0
  15. package/dist/server.js.map +1 -1
  16. package/dist/tools/assignments.d.ts +91 -23
  17. package/dist/tools/assignments.d.ts.map +1 -1
  18. package/dist/tools/assignments.js +115 -35
  19. package/dist/tools/assignments.js.map +1 -1
  20. package/dist/tools/comparison.d.ts +32 -0
  21. package/dist/tools/comparison.d.ts.map +1 -0
  22. package/dist/tools/comparison.js +137 -0
  23. package/dist/tools/comparison.js.map +1 -0
  24. package/dist/tools/course.d.ts +111 -0
  25. package/dist/tools/course.d.ts.map +1 -0
  26. package/dist/tools/course.js +144 -0
  27. package/dist/tools/course.js.map +1 -0
  28. package/dist/tools/index.d.ts +238 -35
  29. package/dist/tools/index.d.ts.map +1 -1
  30. package/dist/tools/index.js +7 -1
  31. package/dist/tools/index.js.map +1 -1
  32. package/dist/tools/material-editor.d.ts +180 -0
  33. package/dist/tools/material-editor.d.ts.map +1 -0
  34. package/dist/tools/material-editor.js +306 -0
  35. package/dist/tools/material-editor.js.map +1 -0
  36. package/dist/tools/site.d.ts +3 -1
  37. package/dist/tools/site.d.ts.map +1 -1
  38. package/dist/tools/site.js +2 -0
  39. package/dist/tools/site.js.map +1 -1
  40. package/dist/utils/schemas.d.ts +1 -0
  41. package/dist/utils/schemas.d.ts.map +1 -1
  42. package/dist/utils/schemas.js +5 -0
  43. package/dist/utils/schemas.js.map +1 -1
  44. package/dist/version.d.ts +4 -4
  45. package/dist/version.js +4 -4
  46. package/package.json +3 -1
@@ -0,0 +1,144 @@
1
+ import { z } from 'zod';
2
+ import { parseFragment } from 'parse5';
3
+ import { WS } from '../api/functions.js';
4
+ import { getMoodleClient } from '../api/moodle-client.js';
5
+ import { htmlToText } from '../utils/format.js';
6
+ import { cmidSchema, courseIdSchema } from '../utils/schemas.js';
7
+ import { defineTool, reqOpts } from './types.js';
8
+ export async function getActivityModule(cmid, type, opts) {
9
+ const { cm } = await getMoodleClient().call(WS.courseModule, { cmid }, opts);
10
+ if (cm.modname !== type)
11
+ throw new Error(`Expected a ${type} activity, got ${cm.modname} for cmid ${cmid}.`);
12
+ return cm;
13
+ }
14
+ function visibility(value) {
15
+ return value === undefined ? null : Boolean(value);
16
+ }
17
+ function publicUrl(raw, base) {
18
+ try {
19
+ const u = new URL(raw, base);
20
+ if (!['http:', 'https:', 'mailto:', 'tel:'].includes(u.protocol))
21
+ return null;
22
+ u.searchParams.delete('token');
23
+ u.searchParams.delete('wstoken');
24
+ return u.href;
25
+ }
26
+ catch {
27
+ return null;
28
+ }
29
+ }
30
+ function pageLinks(html, base) {
31
+ const links = [];
32
+ function label(node) {
33
+ if ('value' in node)
34
+ return node.value;
35
+ if ('tagName' in node && node.tagName === 'img')
36
+ return node.attrs.find((a) => a.name === 'alt')?.value ?? '';
37
+ return 'childNodes' in node ? node.childNodes.map(label).join('') : '';
38
+ }
39
+ function walk(node) {
40
+ if ('tagName' in node && node.tagName === 'a') {
41
+ const href = node.attrs.find((a) => a.name === 'href');
42
+ const url = href && publicUrl(href.value, base);
43
+ if (url)
44
+ links.push({ label: label(node).replace(/\s+/g, ' ').trim(), url });
45
+ }
46
+ if ('childNodes' in node)
47
+ node.childNodes.forEach(walk);
48
+ }
49
+ parseFragment(html).childNodes.forEach(walk);
50
+ return links;
51
+ }
52
+ export async function coursePages(courseId, opts) {
53
+ const { pages, warnings } = await getMoodleClient().call(WS.pages, { courseids: [courseId] }, opts);
54
+ if (warnings?.length)
55
+ throw new Error(warnings.map((w) => w.message).join(' '));
56
+ return pages
57
+ .filter((p) => p.course === courseId)
58
+ .map((p) => {
59
+ const url = `${getMoodleClient().siteUrl}/mod/page/view.php?id=${p.coursemodule}`;
60
+ return {
61
+ cmid: p.coursemodule,
62
+ instanceId: p.id,
63
+ name: p.name,
64
+ url,
65
+ text: htmlToText(p.content),
66
+ links: pageLinks(p.content ?? '', url),
67
+ files: (p.contentfiles ?? []).map((f) => ({
68
+ name: f.filename,
69
+ path: f.filepath,
70
+ size: f.filesize,
71
+ url: publicUrl(f.fileurl, url),
72
+ })),
73
+ };
74
+ });
75
+ }
76
+ export async function courseContents(courseId, opts) {
77
+ const sections = await getMoodleClient().call(WS.contents, { courseid: courseId, options: [{ name: 'excludecontents', value: 1 }] }, opts);
78
+ return sections.map((s) => ({
79
+ id: s.id,
80
+ position: s.section,
81
+ name: s.name,
82
+ visible: visibility(s.visible),
83
+ activities: s.modules.map((m) => ({
84
+ cmid: m.id,
85
+ instanceId: m.instance,
86
+ type: m.modname,
87
+ name: m.name,
88
+ visible: visibility(m.visible),
89
+ accessibleToCurrentUser: m.uservisible ?? null,
90
+ url: m.url ?? null,
91
+ })),
92
+ }));
93
+ }
94
+ const choice = z.object({ answertext: z.string(), answercount: z.number().int().nonnegative() });
95
+ const readOnly = { readOnlyHint: true, idempotentHint: true };
96
+ export const courseTools = {
97
+ moodle_get_course_contents: defineTool({
98
+ description: 'Course outline in Moodle display order. Returns sections, activities, visibility, links, cmid and instanceId. Visibility restrictions can depend on the viewer.',
99
+ inputSchema: z.object({ courseId: courseIdSchema }),
100
+ annotations: readOnly,
101
+ async execute({ courseId }, signal) {
102
+ return { courseId, sections: await courseContents(courseId, reqOpts(signal)) };
103
+ },
104
+ }),
105
+ moodle_get_page: defineTool({
106
+ description: 'Read a Page activity by cmid, including text, labelled link targets and attached files for moodle_download_file.',
107
+ inputSchema: z.object({ cmid: cmidSchema }),
108
+ annotations: readOnly,
109
+ async execute({ cmid }, signal) {
110
+ const opts = reqOpts(signal);
111
+ const cm = await getActivityModule(cmid, 'page', opts);
112
+ const page = (await coursePages(cm.course, opts)).find((p) => p.cmid === cmid);
113
+ if (!page)
114
+ throw new Error('Page unavailable in this course.');
115
+ return page;
116
+ },
117
+ }),
118
+ moodle_get_feedback_summary: defineTool({
119
+ description: 'Feedback activity analysis by cmid. Returns completion count and aggregate choice counts, including rated multiple-choice questions. Omits individual responses and free text.',
120
+ inputSchema: z.object({ cmid: cmidSchema }),
121
+ annotations: readOnly,
122
+ async execute({ cmid }, signal) {
123
+ const opts = reqOpts(signal);
124
+ const cm = await getActivityModule(cmid, 'feedback', opts);
125
+ const a = await getMoodleClient().call(WS.feedbackAnalysis, { feedbackid: cm.instance }, opts);
126
+ if (a.warnings?.length)
127
+ throw new Error(a.warnings.map((w) => w.message).join(' '));
128
+ const questions = (a.itemsdata ?? [])
129
+ .filter((q) => ['multichoice', 'multichoicerated'].includes(q.item.typ))
130
+ .map((q) => ({
131
+ id: q.item.id,
132
+ question: htmlToText(q.item.name),
133
+ choices: (q.data ?? []).map((raw) => {
134
+ const row = choice.safeParse(JSON.parse(raw));
135
+ if (!row.success)
136
+ throw new Error('Unsupported Moodle aggregate choice format.');
137
+ return { label: htmlToText(row.data.answertext), count: row.data.answercount };
138
+ }),
139
+ }));
140
+ return { cmid, completedCount: a.completedcount, questions };
141
+ },
142
+ }),
143
+ };
144
+ //# sourceMappingURL=course.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"course.js","sourceRoot":"","sources":["../../src/tools/course.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAgC,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC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,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC9C,IAAI,CAAC,GAAG,CAAC,OAAO;wBAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;oBACjF,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjF,CAAC,CAAC;aACH,CAAC,CAAC,CAAC;YACN,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC,cAAc,EAAE,SAAS,EAAE,CAAC;QAC/D,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -3,16 +3,126 @@
3
3
  * `scripts/tool-docs.mjs`; новый модуль без записи там роняет генератор.
4
4
  */
5
5
  import { assignmentsTools } from './assignments.js';
6
+ import { courseTools } from './course.js';
7
+ import { comparisonTools } from './comparison.js';
8
+ import { editorTools } from './material-editor.js';
6
9
  import { filesTools } from './files.js';
7
10
  import { gradingTools } from './grading.js';
8
11
  import { siteTools } from './site.js';
9
12
  export declare const allTools: {
13
+ readonly moodle_get_course_contents: import("./types.js").ToolDef<import("zod").ZodObject<{
14
+ courseId: import("zod").ZodNumber;
15
+ }, "strip", import("zod").ZodTypeAny, {
16
+ courseId: number;
17
+ }, {
18
+ courseId: number;
19
+ }>, import("zod").ZodTypeAny, {
20
+ courseId: number;
21
+ sections: {
22
+ id: number;
23
+ position: number;
24
+ name: string;
25
+ visible: boolean | null;
26
+ activities: {
27
+ cmid: number;
28
+ instanceId: number;
29
+ type: string;
30
+ name: string;
31
+ visible: boolean | null;
32
+ accessibleToCurrentUser: boolean | null;
33
+ url: string | null;
34
+ }[];
35
+ }[];
36
+ }>;
37
+ readonly moodle_get_page: import("./types.js").ToolDef<import("zod").ZodObject<{
38
+ cmid: import("zod").ZodNumber;
39
+ }, "strip", import("zod").ZodTypeAny, {
40
+ cmid: number;
41
+ }, {
42
+ cmid: number;
43
+ }>, import("zod").ZodTypeAny, {
44
+ cmid: number;
45
+ instanceId: number;
46
+ name: string;
47
+ url: string;
48
+ text: string;
49
+ links: {
50
+ label: string;
51
+ url: string;
52
+ }[];
53
+ files: {
54
+ name: string;
55
+ path: string;
56
+ size: number;
57
+ url: string | null;
58
+ }[];
59
+ }>;
60
+ readonly moodle_get_feedback_summary: import("./types.js").ToolDef<import("zod").ZodObject<{
61
+ cmid: import("zod").ZodNumber;
62
+ }, "strip", import("zod").ZodTypeAny, {
63
+ cmid: number;
64
+ }, {
65
+ cmid: number;
66
+ }>, import("zod").ZodTypeAny, {
67
+ cmid: number;
68
+ completedCount: number;
69
+ questions: {
70
+ id: number;
71
+ question: string;
72
+ choices: {
73
+ label: string;
74
+ count: number;
75
+ }[];
76
+ }[];
77
+ }>;
78
+ readonly moodle_get_assignment: import("./types.js").ToolDef<import("zod").ZodObject<{
79
+ cmid: import("zod").ZodNumber;
80
+ }, "strip", import("zod").ZodTypeAny, {
81
+ cmid: number;
82
+ }, {
83
+ cmid: number;
84
+ }>, import("zod").ZodTypeAny, {
85
+ id: number;
86
+ cmid: number;
87
+ name: string;
88
+ url: string;
89
+ opensAt: string | null;
90
+ dueAt: string | null;
91
+ cutoffAt: string | null;
92
+ gradingDueAt: string | null;
93
+ grading: {
94
+ type: 'points';
95
+ max: number;
96
+ passGrade: number | null;
97
+ } | {
98
+ type: 'scale';
99
+ scaleId: number;
100
+ passGrade: number | null;
101
+ } | {
102
+ type: 'none';
103
+ passGrade: number | null;
104
+ };
105
+ submissionTypes: string[];
106
+ feedbackTypes: string[];
107
+ maxAttempts: number | null;
108
+ teamSubmission: boolean;
109
+ markingWorkflow: boolean;
110
+ blindMarking: boolean;
111
+ description: string;
112
+ attachments: {
113
+ name: string;
114
+ url: string;
115
+ }[];
116
+ }>;
10
117
  readonly moodle_list_assignments: import("./types.js").ToolDef<import("zod").ZodObject<{
11
118
  courseId: import("zod").ZodNumber;
119
+ brief: import("zod").ZodOptional<import("zod").ZodBoolean>;
12
120
  }, "strip", import("zod").ZodTypeAny, {
13
121
  courseId: number;
122
+ brief?: boolean | undefined;
14
123
  }, {
15
124
  courseId: number;
125
+ brief?: boolean | undefined;
16
126
  }>, import("zod").ZodTypeAny, {
17
127
  courseId: number;
18
128
  items: {
@@ -24,29 +134,6 @@ export declare const allTools: {
24
134
  dueAt: string | null;
25
135
  cutoffAt: string | null;
26
136
  gradingDueAt: string | null;
27
- grading: {
28
- type: 'points';
29
- max: number;
30
- passGrade: number | null;
31
- } | {
32
- type: 'scale';
33
- scaleId: number;
34
- passGrade: number | null;
35
- } | {
36
- type: 'none';
37
- passGrade: number | null;
38
- };
39
- submissionTypes: string[];
40
- feedbackTypes: string[];
41
- maxAttempts: number | null;
42
- teamSubmission: boolean;
43
- markingWorkflow: boolean;
44
- blindMarking: boolean;
45
- description: string;
46
- attachments: {
47
- name: string;
48
- url: string;
49
- }[];
50
137
  }[];
51
138
  }>;
52
139
  readonly moodle_list_submissions: import("./types.js").ToolDef<import("zod").ZodObject<{
@@ -60,6 +147,12 @@ export declare const allTools: {
60
147
  status?: "all" | "draft" | "graded" | "needs_attention" | "needs_grading" | "not_submitted" | "open" | "submitted" | undefined;
61
148
  }>, import("zod").ZodTypeAny, {
62
149
  assignmentId: number;
150
+ reviewSummary: {
151
+ needsAttention: number;
152
+ waitingForStudent: number;
153
+ commentsUnavailable: number;
154
+ byReview: Partial<Record<import("../utils/review-state.js").ReviewState, number>>;
155
+ };
63
156
  counts: {
64
157
  participants: number;
65
158
  submitted: number;
@@ -99,6 +192,12 @@ export declare const allTools: {
99
192
  }>, import("zod").ZodTypeAny, {
100
193
  courseId: number;
101
194
  assignments: number;
195
+ reviewSummary: {
196
+ needsAttention: number;
197
+ waitingForStudent: number;
198
+ commentsUnavailable: number;
199
+ byReview: Partial<Record<import("../utils/review-state.js").ReviewState, number>>;
200
+ };
102
201
  filter: "needs_attention" | "open";
103
202
  counts: Partial<Record<"awaiting_student" | "graded" | "new_submission" | "not_submitted" | "resubmitted" | "rework" | "student_comment" | "update_reviewed" | "update_unreviewed", number>>;
104
203
  items: {
@@ -170,19 +269,33 @@ export declare const allTools: {
170
269
  text: string;
171
270
  }[] | null;
172
271
  }>;
173
- readonly moodle_download_file: import("./types.js").ToolDef<import("zod").ZodObject<{
174
- fileUrl: import("zod").ZodString;
175
- destDir: import("zod").ZodEffects<import("zod").ZodString, string, string>;
272
+ readonly moodle_compare_course_materials: import("./types.js").ToolDef<import("zod").ZodObject<{
273
+ sourceCourseId: import("zod").ZodNumber;
274
+ targetCourseId: import("zod").ZodNumber;
275
+ sourceLabel: import("zod").ZodOptional<import("zod").ZodString>;
176
276
  }, "strip", import("zod").ZodTypeAny, {
177
- fileUrl: string;
178
- destDir: string;
277
+ sourceCourseId: number;
278
+ targetCourseId: number;
279
+ sourceLabel?: string | undefined;
179
280
  }, {
180
- fileUrl: string;
181
- destDir: string;
281
+ sourceCourseId: number;
282
+ targetCourseId: number;
283
+ sourceLabel?: string | undefined;
182
284
  }>, import("zod").ZodTypeAny, {
183
- path: string;
184
- bytes: number;
185
- mimeType: string | null;
285
+ sourceCourseId: number;
286
+ targetCourseId: number;
287
+ differences: {
288
+ section: number;
289
+ position?: number;
290
+ field: string;
291
+ source: unknown;
292
+ target: unknown;
293
+ }[];
294
+ retainedTitles: {
295
+ section: number;
296
+ cmid?: number;
297
+ name: string;
298
+ }[];
186
299
  }>;
187
300
  readonly moodle_site_info: import("./types.js").ToolDef<import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("zod").ZodTypeAny, {
188
301
  site: {
@@ -200,7 +313,9 @@ export declare const allTools: {
200
313
  package: string;
201
314
  version: string;
202
315
  };
203
- missingFunctions: ("core_comment_add_comments" | "core_comment_get_comments" | "core_course_get_course_module" | "core_course_get_course_module_by_instance" | "core_enrol_get_users_courses" | "core_webservice_get_site_info" | "mod_assign_get_assignments" | "mod_assign_get_grades" | "mod_assign_get_participant" | "mod_assign_get_submission_status" | "mod_assign_get_submissions" | "mod_assign_list_participants" | "mod_assign_revert_submissions_to_draft" | "mod_assign_save_grade" | "mod_assign_submit_grading_form")[];
316
+ availableFunctions: ("core_comment_add_comments" | "core_comment_get_comments" | "core_course_get_contents" | "core_course_get_course_module" | "core_course_get_course_module_by_instance" | "core_enrol_get_users_courses" | "core_webservice_get_site_info" | "mod_assign_get_assignments" | "mod_assign_get_grades" | "mod_assign_get_participant" | "mod_assign_get_submission_status" | "mod_assign_get_submissions" | "mod_assign_list_participants" | "mod_assign_revert_submissions_to_draft" | "mod_assign_save_grade" | "mod_assign_submit_grading_form" | "mod_feedback_get_analysis" | "mod_page_get_pages_by_courses")[];
317
+ permissionScope: string;
318
+ missingFunctions: ("core_comment_add_comments" | "core_comment_get_comments" | "core_course_get_contents" | "core_course_get_course_module" | "core_course_get_course_module_by_instance" | "core_enrol_get_users_courses" | "core_webservice_get_site_info" | "mod_assign_get_assignments" | "mod_assign_get_grades" | "mod_assign_get_participant" | "mod_assign_get_submission_status" | "mod_assign_get_submissions" | "mod_assign_list_participants" | "mod_assign_revert_submissions_to_draft" | "mod_assign_save_grade" | "mod_assign_submit_grading_form" | "mod_feedback_get_analysis" | "mod_page_get_pages_by_courses")[];
204
319
  uploadFiles: boolean | null;
205
320
  maxUploadBytes: number | null;
206
321
  }>;
@@ -215,6 +330,94 @@ export declare const allTools: {
215
330
  lastAccessAt: string | null;
216
331
  }[];
217
332
  }>;
333
+ readonly moodle_preview_material_edit: import("./types.js").ToolDef<import("zod").ZodObject<{
334
+ cmid: import("zod").ZodNumber;
335
+ field: import("zod").ZodEnum<["page", "introeditor", "introattachments"]>;
336
+ name: import("zod").ZodOptional<import("zod").ZodString>;
337
+ html: import("zod").ZodOptional<import("zod").ZodString>;
338
+ remove: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEffects<import("zod").ZodString, string, string>, "many">>;
339
+ upload: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
340
+ path: import("zod").ZodEffects<import("zod").ZodString, string, string>;
341
+ name: import("zod").ZodEffects<import("zod").ZodString, string, string>;
342
+ }, "strip", import("zod").ZodTypeAny, {
343
+ path: string;
344
+ name: string;
345
+ }, {
346
+ path: string;
347
+ name: string;
348
+ }>, "many">>;
349
+ }, "strip", import("zod").ZodTypeAny, {
350
+ cmid: number;
351
+ field: "introattachments" | "introeditor" | "page";
352
+ name?: string | undefined;
353
+ html?: string | undefined;
354
+ remove?: string[] | undefined;
355
+ upload?: {
356
+ path: string;
357
+ name: string;
358
+ }[] | undefined;
359
+ }, {
360
+ cmid: number;
361
+ field: "introattachments" | "introeditor" | "page";
362
+ name?: string | undefined;
363
+ html?: string | undefined;
364
+ remove?: string[] | undefined;
365
+ upload?: {
366
+ path: string;
367
+ name: string;
368
+ }[] | undefined;
369
+ }>, import("zod").ZodTypeAny, {
370
+ cmid: number;
371
+ field: "introattachments" | "introeditor" | "page";
372
+ before: {
373
+ name: string;
374
+ html: string | null;
375
+ files: {
376
+ name: string;
377
+ size: string | number | null;
378
+ modified: number | null;
379
+ type: string | null;
380
+ }[];
381
+ };
382
+ after: {
383
+ name: string;
384
+ html: string | null;
385
+ files: {
386
+ name: string;
387
+ size: string | number | null;
388
+ modified: number | null;
389
+ type: string | null;
390
+ }[];
391
+ };
392
+ uploadSha256: {
393
+ [k: string]: string;
394
+ };
395
+ previewId: `${string}-${string}-${string}-${string}-${string}`;
396
+ }>;
397
+ readonly moodle_apply_material_edit: import("./types.js").ToolDef<import("zod").ZodObject<{
398
+ previewId: import("zod").ZodString;
399
+ }, "strip", import("zod").ZodTypeAny, {
400
+ previewId: string;
401
+ }, {
402
+ previewId: string;
403
+ }>, import("zod").ZodTypeAny, {
404
+ cmid: number;
405
+ saved: boolean;
406
+ }>;
407
+ readonly moodle_download_file: import("./types.js").ToolDef<import("zod").ZodObject<{
408
+ fileUrl: import("zod").ZodString;
409
+ destDir: import("zod").ZodEffects<import("zod").ZodString, string, string>;
410
+ }, "strip", import("zod").ZodTypeAny, {
411
+ fileUrl: string;
412
+ destDir: string;
413
+ }, {
414
+ fileUrl: string;
415
+ destDir: string;
416
+ }>, import("zod").ZodTypeAny, {
417
+ path: string;
418
+ bytes: number;
419
+ mimeType: string | null;
420
+ }>;
218
421
  readonly moodle_save_grade: import("./types.js").ToolDef<import("zod").ZodObject<{
219
422
  assignmentId: import("zod").ZodNumber;
220
423
  userId: import("zod").ZodNumber;
@@ -317,5 +520,5 @@ export declare const allTools: {
317
520
  modifiedAt: string | null;
318
521
  }>;
319
522
  };
320
- export { assignmentsTools, filesTools, gradingTools, siteTools };
523
+ export { comparisonTools, courseTools, editorTools, assignmentsTools, filesTools, gradingTools, siteTools, };
321
524
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKX,CAAC;AAEX,OAAO,EAAE,gBAAgB,EAA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C"}
@@ -3,14 +3,20 @@
3
3
  * `scripts/tool-docs.mjs`; новый модуль без записи там роняет генератор.
4
4
  */
5
5
  import { assignmentsTools } from './assignments.js';
6
+ import { courseTools } from './course.js';
7
+ import { comparisonTools } from './comparison.js';
8
+ import { editorTools } from './material-editor.js';
6
9
  import { filesTools } from './files.js';
7
10
  import { gradingTools } from './grading.js';
8
11
  import { siteTools } from './site.js';
9
12
  export const allTools = {
10
13
  ...siteTools,
14
+ ...courseTools,
15
+ ...comparisonTools,
16
+ ...editorTools,
11
17
  ...assignmentsTools,
12
18
  ...filesTools,
13
19
  ...gradingTools,
14
20
  };
15
- export { assignmentsTools, filesTools, gradingTools, siteTools };
21
+ export { comparisonTools, courseTools, editorTools, assignmentsTools, filesTools, gradingTools, siteTools, };
16
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,SAAS;IACZ,GAAG,gBAAgB;IACnB,GAAG,UAAU;IACb,GAAG,YAAY;CACP,CAAC;AAEX,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,SAAS;IACZ,GAAG,WAAW;IACd,GAAG,eAAe;IAClB,GAAG,WAAW;IACd,GAAG,gBAAgB;IACnB,GAAG,UAAU;IACb,GAAG,YAAY;CACP,CAAC;AAEX,OAAO,EACL,eAAe,EACf,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,SAAS,GACV,CAAC"}