brightspace-mcp-server 5.1.40 → 5.1.42

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.
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { ApiError, DEFAULT_CACHE_TTLS } from "../api/index.js";
7
7
  import { GetAssignmentRubricSchema } from "./schemas.js";
8
- import { toolResponse, sanitizeError } from "./tool-helpers.js";
8
+ import { toolResponse, sanitizeError, throwIfCredentialRejected } from "./tool-helpers.js";
9
9
  import { feedbackText } from "../utils/feedback.js";
10
10
  import { log } from "../utils/logger.js";
11
11
  // D2L's documented SCORING_M enumeration
@@ -216,13 +216,21 @@ export async function fetchAssignmentRubrics(apiClient, courseId, assignmentId)
216
216
  rubrics = Array.isArray(raw) ? raw : raw?.Objects ?? [];
217
217
  }
218
218
  catch (error) {
219
- if (error instanceof ApiError && (error.status === 403 || error.status === 404)) {
220
- rubrics = [];
221
- }
222
- else {
223
- log("DEBUG", `Failed to fetch rubrics for assignment ${assignmentId} via the rubrics endpoint`, error);
224
- rubrics = [];
219
+ throwIfCredentialRejected(error);
220
+ if (!(error instanceof ApiError && (error.status === 403 || error.status === 404))) {
221
+ // Only a 403/404 means "nothing to show here". Anything else (5xx,
222
+ // timeout, network) leaves it unknown whether a rubric is attached,
223
+ // so it must never be reported as "no rubric".
224
+ log("INFO", `get_assignment_rubric: Rubrics for assignment ${assignmentId} in course ${courseId} could not be read`, error);
225
+ return {
226
+ rubrics: [],
227
+ rubricsUnreadable: true,
228
+ note: "The rubric for this assignment could not be read from Brightspace, so it may still have one. " +
229
+ "Do not report the assignment as having no rubric: call get_assignment_rubric again, or check " +
230
+ "the assignment in Brightspace.",
231
+ };
225
232
  }
233
+ rubrics = [];
226
234
  }
227
235
  }
228
236
  if (rubrics.length === 0) {
@@ -257,7 +265,7 @@ export function registerGetAssignmentRubric(server, apiClient) {
257
265
  server.registerTool("get_assignment_rubric", {
258
266
  title: "Get Assignment Rubric",
259
267
  annotations: { readOnlyHint: true },
260
- description: "Fetch the full grading rubric for a dropbox assignment: every criteria group, criterion, and achievement level with its points and description, plus the student's own graded outcome per criterion once it has been released. Use this when the user asks what a rubric wants, how an assignment will be graded, or why they got a particular score on a criterion.",
268
+ description: "Fetch the full grading rubric for a dropbox assignment: every criteria group, criterion, and achievement level with its points and description, plus the student's own graded outcome per criterion once it has been released. If the rubric lookup fails with anything but a 403/404, rubricsUnreadable is true and an empty rubrics list is not proof the assignment has no rubric. Use this when the user asks what a rubric wants, how an assignment will be graded, or why they got a particular score on a criterion.",
261
269
  inputSchema: GetAssignmentRubricSchema,
262
270
  }, async (args) => {
263
271
  try {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { ApiError, DEFAULT_CACHE_TTLS } from "../api/index.js";
7
7
  import { GetDropboxSubmissionsSchema } from "./schemas.js";
8
- import { toolResponse, sanitizeError, errorResponse } from "./tool-helpers.js";
8
+ import { toolResponse, sanitizeError, errorResponse, throwIfCredentialRejected } from "./tool-helpers.js";
9
9
  import { log } from "../utils/logger.js";
10
10
  // Per-submitter feedback lookup is one GET each; cap how many run at once so
11
11
  // a large dropbox folder can't fan out hundreds of concurrent requests.
@@ -100,6 +100,7 @@ export function registerGetDropboxSubmissions(server, apiClient) {
100
100
  feedbackMap.set(userId, fb);
101
101
  }
102
102
  catch (error) {
103
+ throwIfCredentialRejected(error);
103
104
  if (!(error instanceof ApiError && error.status === 404)) {
104
105
  feedbackUnread.add(userId);
105
106
  }
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { ApiError } from "../api/index.js";
7
7
  import { GetDropboxUserSubmissionsSchema } from "./schemas.js";
8
- import { toolResponse, sanitizeError, errorResponse } from "./tool-helpers.js";
8
+ import { toolResponse, sanitizeError, errorResponse, throwIfCredentialRejected } from "./tool-helpers.js";
9
9
  import { log } from "../utils/logger.js";
10
10
  /**
11
11
  * Register get_dropbox_user_submissions tool.
@@ -65,6 +65,7 @@ export function registerGetDropboxUserSubmissions(server, apiClient) {
65
65
  feedback = await apiClient.get(feedbackPath);
66
66
  }
67
67
  catch (error) {
68
+ throwIfCredentialRejected(error);
68
69
  if (!(error instanceof ApiError && error.status === 404)) {
69
70
  feedbackUnread = true;
70
71
  log("INFO", "get_dropbox_user_submissions: Feedback could not be read", { courseId, folderId, userId });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brightspace-mcp-server",
3
- "version": "5.1.40",
3
+ "version": "5.1.42",
4
4
  "mcpName": "io.github.RohanMuppa/brightspace",
5
5
  "description": "MCP server for Brightspace (D2L). Check grades, due dates, assignments, announcements, syllabus, rosters and more via Claude, ChatGPT, Cursor, Windsurf, or any MCP client.",
6
6
  "type": "module",