brightspace-mcp-server 5.2.4 → 5.2.5
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.
|
@@ -14,6 +14,8 @@ import { log } from "../utils/logger.js";
|
|
|
14
14
|
const SELF_ENROLLMENT_STYLES = new Set([3, 4, 5]);
|
|
15
15
|
/** Without a courseId, courses that started longer ago than this are skipped unless includeOlder is set. */
|
|
16
16
|
const RECENT_COURSE_MS = 365 * 24 * 60 * 60 * 1000;
|
|
17
|
+
/** Why a category's groups couldn't be read, in words an agent can relay. */
|
|
18
|
+
const unreadReason = (status) => status === 403 ? "Brightspace refused access (403)" : "Brightspace found no group list (404)";
|
|
17
19
|
const inaccessible = (error) => error instanceof ApiError && (error.status === 403 || error.status === 404);
|
|
18
20
|
const text = (value) => value?.Text?.trim() || undefined;
|
|
19
21
|
/**
|
|
@@ -27,7 +29,7 @@ function signUpOpen(category, now) {
|
|
|
27
29
|
const end = category.SelfEnrollmentExpiryDate ? Date.parse(category.SelfEnrollmentExpiryDate) : Infinity;
|
|
28
30
|
return start <= now && now <= end;
|
|
29
31
|
}
|
|
30
|
-
async function fetchCourseGroups(apiClient, course, myId, now) {
|
|
32
|
+
async function fetchCourseGroups(apiClient, course, myId, now, unreadOut) {
|
|
31
33
|
const result = { courseId: course.id, courseName: course.name, categories: [], alreadyInGroup: [] };
|
|
32
34
|
let categories;
|
|
33
35
|
try {
|
|
@@ -47,6 +49,7 @@ async function fetchCourseGroups(apiClient, course, myId, now) {
|
|
|
47
49
|
catch (error) {
|
|
48
50
|
if (inaccessible(error)) {
|
|
49
51
|
unread.push(category.Name);
|
|
52
|
+
unreadOut.push({ courseId: course.id, name: category.Name, status: error.status });
|
|
50
53
|
continue;
|
|
51
54
|
}
|
|
52
55
|
throw error;
|
|
@@ -115,7 +118,8 @@ export function registerGetAvailableGroups(server, apiClient, config) {
|
|
|
115
118
|
return Number.isFinite(start) && start >= now - RECENT_COURSE_MS;
|
|
116
119
|
});
|
|
117
120
|
const olderSkipped = enrolled.length - courses.length;
|
|
118
|
-
const
|
|
121
|
+
const unreadCategories = [];
|
|
122
|
+
const results = await Promise.allSettled(courses.map((course) => fetchCourseGroups(apiClient, course, myId, now, unreadCategories)));
|
|
119
123
|
const pendingCourseIds = [];
|
|
120
124
|
const failedCourseIds = [];
|
|
121
125
|
let firstAuthError = null;
|
|
@@ -149,6 +153,16 @@ export function registerGetAvailableGroups(server, apiClient, config) {
|
|
|
149
153
|
if (failedCourseIds.length > 0) {
|
|
150
154
|
notes.push(`Couldn't read groups for course(s) ${failedCourseIds.join(", ")}, so open sign-ups there aren't listed.`);
|
|
151
155
|
}
|
|
156
|
+
// Without a reason attached, a bare unreadCategories list reads like a
|
|
157
|
+
// category with nothing open, so name each one and say why it's there (#433).
|
|
158
|
+
const shownCourseIds = new Set(withChoices.map((c) => c.courseId));
|
|
159
|
+
const unread = unreadCategories.filter((u) => shownCourseIds.has(u.courseId));
|
|
160
|
+
if (unread.length > 0) {
|
|
161
|
+
const where = unread.map((u) => `"${u.name}" in course ${u.courseId}: ${unreadReason(u.status)}`).join("; ");
|
|
162
|
+
notes.push(`Couldn't read the groups in these open sign-ups, so any open groups there aren't listed ` +
|
|
163
|
+
`(see unreadCategories): ${where}. Don't report them as full or closed; ` +
|
|
164
|
+
"check Groups > Available Groups in Brightspace.");
|
|
165
|
+
}
|
|
152
166
|
const data = {
|
|
153
167
|
coursesChecked: courses.length,
|
|
154
168
|
courses: withChoices,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brightspace-mcp-server",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.5",
|
|
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",
|