canvas-lms-mcp 1.19.2 → 1.20.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.
@@ -1,17 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkNG6KBHE4cjs = require('../chunk-NG6KBHE4.cjs');
3
+ var _chunkAAVMFVMIcjs = require('../chunk-AAVMFVMI.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
8
 
9
- var _chunkZB3IRQKCcjs = require('../chunk-ZB3IRQKC.cjs');
9
+ var _chunkEBW2RMVAcjs = require('../chunk-EBW2RMVA.cjs');
10
10
 
11
11
 
12
12
 
13
13
 
14
14
 
15
15
 
16
- exports.CanvasApiError = _chunkZB3IRQKCcjs.CanvasApiError; exports.CanvasClient = _chunkNG6KBHE4cjs.CanvasClient; exports.CanvasHttpClient = _chunkZB3IRQKCcjs.CanvasHttpClient; exports.appendCanvasQuery = _chunkZB3IRQKCcjs.appendCanvasQuery; exports.toCanvasQuery = _chunkZB3IRQKCcjs.toCanvasQuery;
16
+ exports.CanvasApiError = _chunkEBW2RMVAcjs.CanvasApiError; exports.CanvasClient = _chunkAAVMFVMIcjs.CanvasClient; exports.CanvasHttpClient = _chunkEBW2RMVAcjs.CanvasHttpClient; exports.appendCanvasQuery = _chunkEBW2RMVAcjs.appendCanvasQuery; exports.toCanvasQuery = _chunkEBW2RMVAcjs.toCanvasQuery;
17
17
  //# sourceMappingURL=index.cjs.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  CanvasClient
3
- } from "../chunk-32RJEARZ.js";
3
+ } from "../chunk-Q4NKB7OZ.js";
4
4
  import {
5
5
  CanvasApiError,
6
6
  CanvasHttpClient,
7
7
  appendCanvasQuery,
8
8
  toCanvasQuery
9
- } from "../chunk-HZU2YDP4.js";
9
+ } from "../chunk-GXFYXAO5.js";
10
10
  export {
11
11
  CanvasApiError,
12
12
  CanvasClient,
@@ -7,11 +7,11 @@ import {
7
7
  OUTCOME_ROLLUP_SORT_BY,
8
8
  OUTCOME_SORT_ORDER,
9
9
  SEARCH_CONTENT_TYPES
10
- } from "./chunk-32RJEARZ.js";
10
+ } from "./chunk-Q4NKB7OZ.js";
11
11
  import {
12
12
  CanvasApiError,
13
13
  version
14
- } from "./chunk-HZU2YDP4.js";
14
+ } from "./chunk-GXFYXAO5.js";
15
15
 
16
16
  // src/server.ts
17
17
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -729,10 +729,15 @@ function assignmentTools(canvas) {
729
729
  return [
730
730
  {
731
731
  name: "list_assignments",
732
- description: "List all assignments in a course. Use `include` to request submission, all_dates, overrides, score_statistics, etc. Use `bucket` to filter by past/upcoming/overdue/etc. Other filters: `search_term`, `assignment_ids`, `order_by`.",
732
+ description: 'List all assignments in a course. Use fields="slim" when enumerating assignments for selection; switch to "full" once you\'ve identified the target. slim returns id, name, due_at, points_possible, published, and course_id only. "full" (default) includes all Canvas fields plus `include` extras (submission, all_dates, overrides, score_statistics, etc.). Use `bucket` to filter by past/upcoming/overdue/etc. Other filters: `search_term`, `assignment_ids`, `order_by`.',
733
733
  inputSchema: {
734
734
  course_id: z3.number().describe("The Canvas course ID"),
735
- include: z3.array(z3.enum(ASSIGNMENT_LIST_INCLUDE)).optional().describe("Extra fields to include on each assignment (Canvas include[] param)"),
735
+ fields: z3.enum(["slim", "full"]).optional().describe(
736
+ 'Projection mode: "slim" returns id/name/due_at/points_possible/published/course_id only; "full" (default) returns all fields'
737
+ ),
738
+ include: z3.array(z3.enum(ASSIGNMENT_LIST_INCLUDE)).optional().describe(
739
+ 'Extra fields to include on each assignment (Canvas include[] param); ignored when fields="slim"'
740
+ ),
736
741
  search_term: z3.string().optional().describe("Partial name substring to filter assignments by"),
737
742
  bucket: z3.enum(ASSIGNMENT_BUCKET).optional().describe("Only include assignments in the given bucket"),
738
743
  assignment_ids: z3.array(z3.number()).optional().describe("Restrict to the given list of assignment IDs"),
@@ -748,8 +753,9 @@ function assignmentTools(canvas) {
748
753
  openWorldHint: true
749
754
  },
750
755
  handler: async (params) => {
756
+ const slim = params.fields === "slim";
751
757
  const opts = {};
752
- if (params.include !== void 0)
758
+ if (!slim && params.include !== void 0)
753
759
  opts.include = params.include;
754
760
  if (params.search_term !== void 0) opts.search_term = params.search_term;
755
761
  if (params.bucket !== void 0) opts.bucket = params.bucket;
@@ -761,7 +767,16 @@ function assignmentTools(canvas) {
761
767
  if (params.needs_grading_count_by_section !== void 0)
762
768
  opts.needs_grading_count_by_section = params.needs_grading_count_by_section;
763
769
  if (params.post_to_sis !== void 0) opts.post_to_sis = params.post_to_sis;
764
- return canvas.assignments.list(params.course_id, opts);
770
+ const assignments = await canvas.assignments.list(params.course_id, opts);
771
+ if (!slim) return assignments;
772
+ return assignments.map((a) => ({
773
+ id: a.id,
774
+ name: a.name,
775
+ due_at: a.due_at,
776
+ points_possible: a.points_possible,
777
+ published: a.published,
778
+ course_id: a.course_id
779
+ }));
765
780
  }
766
781
  },
767
782
  {
@@ -1072,11 +1087,16 @@ function courseTools(canvas) {
1072
1087
  return [
1073
1088
  {
1074
1089
  name: "list_courses",
1075
- description: "List courses for the authenticated user. `include` adds optional fields (teachers, total_students, term, syllabus_body, etc.). `state[]` narrows by course workflow state; `enrollment_state` narrows by the caller\u2019s enrollment state.",
1090
+ description: 'List courses for the authenticated user. Use fields="slim" when enumerating courses for selection; switch to "full" once you have identified the target. slim returns id, name, course_code, term name, and workflow_state only. "full" (default) includes all Canvas fields plus `include` extras (teachers, total_students, syllabus_body, etc.). `state[]` narrows by course workflow state; `enrollment_state` narrows by the caller\'s enrollment state.',
1076
1091
  inputSchema: {
1077
- enrollment_state: z6.enum(COURSE_ENROLLMENT_STATE).optional().describe("Filter courses by the caller\u2019s enrollment state"),
1092
+ fields: z6.enum(["slim", "full"]).optional().describe(
1093
+ 'Projection mode: "slim" returns id/name/course_code/term/workflow_state only; "full" (default) returns all fields'
1094
+ ),
1095
+ enrollment_state: z6.enum(COURSE_ENROLLMENT_STATE).optional().describe("Filter courses by the caller's enrollment state"),
1078
1096
  state: z6.array(z6.enum(COURSE_WORKFLOW_STATE)).optional().describe("Filter by course workflow state"),
1079
- include: z6.array(z6.enum(COURSE_LIST_INCLUDE)).optional().describe("Extra fields to include on each course (Canvas include[] param)"),
1097
+ include: z6.array(z6.enum(COURSE_LIST_INCLUDE)).optional().describe(
1098
+ 'Extra fields to include on each course (Canvas include[] param); ignored when fields="slim"'
1099
+ ),
1080
1100
  exclude_blueprint_courses: z6.boolean().optional().describe("Exclude blueprint courses from the results")
1081
1101
  },
1082
1102
  annotations: {
@@ -1084,16 +1104,25 @@ function courseTools(canvas) {
1084
1104
  openWorldHint: true
1085
1105
  },
1086
1106
  handler: async (params) => {
1107
+ const slim = params.fields === "slim";
1087
1108
  const opts = {};
1088
1109
  if (params.enrollment_state !== void 0)
1089
1110
  opts.enrollment_state = params.enrollment_state;
1090
1111
  if (params.state !== void 0)
1091
1112
  opts.state = params.state;
1092
- if (params.include !== void 0)
1113
+ if (!slim && params.include !== void 0)
1093
1114
  opts.include = params.include;
1094
1115
  if (params.exclude_blueprint_courses !== void 0)
1095
1116
  opts.exclude_blueprint_courses = params.exclude_blueprint_courses;
1096
- return canvas.courses.list(opts);
1117
+ const courses = await canvas.courses.list(opts);
1118
+ if (!slim) return courses;
1119
+ return courses.map((c) => ({
1120
+ id: c.id,
1121
+ name: c.name,
1122
+ course_code: c.course_code,
1123
+ term: c.term?.name ?? null,
1124
+ workflow_state: c.workflow_state
1125
+ }));
1097
1126
  }
1098
1127
  },
1099
1128
  {
@@ -3529,4 +3558,4 @@ export {
3529
3558
  Pseudonymizer,
3530
3559
  createCanvasMCPServer
3531
3560
  };
3532
- //# sourceMappingURL=chunk-FFK6TAPL.js.map
3561
+ //# sourceMappingURL=chunk-6GUSCS62.js.map