gogcli-mcp-classroom 4.5.0 → 4.5.1
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +2 -0
- package/dist/index.js +449 -90
- package/manifest.json +9 -9
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/tools/classroom-extra.ts +247 -19
- package/tests/tools/classroom-extra-gates.test.ts +211 -0
- package/tests/tools/classroom-extra.test.ts +233 -0
package/dist/index.js
CHANGED
|
@@ -956,14 +956,14 @@ function promiseAllObject(promisesObj) {
|
|
|
956
956
|
}
|
|
957
957
|
function randomString(length = 10) {
|
|
958
958
|
const chars = "abcdefghijklmnopqrstuvwxyz";
|
|
959
|
-
let
|
|
959
|
+
let str2 = "";
|
|
960
960
|
for (let i = 0; i < length; i++) {
|
|
961
|
-
|
|
961
|
+
str2 += chars[Math.floor(Math.random() * chars.length)];
|
|
962
962
|
}
|
|
963
|
-
return
|
|
963
|
+
return str2;
|
|
964
964
|
}
|
|
965
|
-
function esc(
|
|
966
|
-
return JSON.stringify(
|
|
965
|
+
function esc(str2) {
|
|
966
|
+
return JSON.stringify(str2);
|
|
967
967
|
}
|
|
968
968
|
function slugify(input2) {
|
|
969
969
|
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -1077,8 +1077,8 @@ var primitiveTypes = /* @__PURE__ */ new Set([
|
|
|
1077
1077
|
"symbol",
|
|
1078
1078
|
"undefined"
|
|
1079
1079
|
]);
|
|
1080
|
-
function escapeRegex(
|
|
1081
|
-
return
|
|
1080
|
+
function escapeRegex(str2) {
|
|
1081
|
+
return str2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1082
1082
|
}
|
|
1083
1083
|
function clone(inst, def, params) {
|
|
1084
1084
|
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
@@ -1332,13 +1332,13 @@ function getSizableOrigin(input2) {
|
|
|
1332
1332
|
return "unknown";
|
|
1333
1333
|
}
|
|
1334
1334
|
var highSurrogate = /[\uD800-\uDBFF]/;
|
|
1335
|
-
function codePointLength(
|
|
1336
|
-
const units =
|
|
1337
|
-
if (!highSurrogate.test(
|
|
1335
|
+
function codePointLength(str2) {
|
|
1336
|
+
const units = str2.length;
|
|
1337
|
+
if (!highSurrogate.test(str2))
|
|
1338
1338
|
return units;
|
|
1339
1339
|
let count = units;
|
|
1340
1340
|
for (let i = 0; i < units - 1; i++) {
|
|
1341
|
-
if ((
|
|
1341
|
+
if ((str2.charCodeAt(i) & 64512) === 55296 && (str2.charCodeAt(i + 1) & 64512) === 56320) {
|
|
1342
1342
|
count--;
|
|
1343
1343
|
i++;
|
|
1344
1344
|
}
|
|
@@ -25451,7 +25451,7 @@ var require_code$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25451
25451
|
}
|
|
25452
25452
|
exports._ = _;
|
|
25453
25453
|
const plus = new _Code("+");
|
|
25454
|
-
function
|
|
25454
|
+
function str2(strs, ...args) {
|
|
25455
25455
|
const expr = [safeStringify(strs[0])];
|
|
25456
25456
|
let i = 0;
|
|
25457
25457
|
while (i < args.length) {
|
|
@@ -25462,7 +25462,7 @@ var require_code$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25462
25462
|
optimize(expr);
|
|
25463
25463
|
return new _Code(expr);
|
|
25464
25464
|
}
|
|
25465
|
-
exports.str =
|
|
25465
|
+
exports.str = str2;
|
|
25466
25466
|
function addCodeArg(code, arg) {
|
|
25467
25467
|
if (arg instanceof _Code) code.push(...arg._items);
|
|
25468
25468
|
else if (arg instanceof Name) code.push(arg);
|
|
@@ -25495,7 +25495,7 @@ var require_code$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25495
25495
|
if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}`;
|
|
25496
25496
|
}
|
|
25497
25497
|
function strConcat(c1, c2) {
|
|
25498
|
-
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 :
|
|
25498
|
+
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str2`${c1}${c2}`;
|
|
25499
25499
|
}
|
|
25500
25500
|
exports.strConcat = strConcat;
|
|
25501
25501
|
function interpolate(x) {
|
|
@@ -26374,21 +26374,21 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26374
26374
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
26375
26375
|
}
|
|
26376
26376
|
exports.schemaRefOrVal = schemaRefOrVal;
|
|
26377
|
-
function unescapeFragment(
|
|
26378
|
-
return unescapeJsonPointer(decodeURIComponent(
|
|
26377
|
+
function unescapeFragment(str2) {
|
|
26378
|
+
return unescapeJsonPointer(decodeURIComponent(str2));
|
|
26379
26379
|
}
|
|
26380
26380
|
exports.unescapeFragment = unescapeFragment;
|
|
26381
|
-
function escapeFragment(
|
|
26382
|
-
return encodeURIComponent(escapeJsonPointer(
|
|
26381
|
+
function escapeFragment(str2) {
|
|
26382
|
+
return encodeURIComponent(escapeJsonPointer(str2));
|
|
26383
26383
|
}
|
|
26384
26384
|
exports.escapeFragment = escapeFragment;
|
|
26385
|
-
function escapeJsonPointer(
|
|
26386
|
-
if (typeof
|
|
26387
|
-
return
|
|
26385
|
+
function escapeJsonPointer(str2) {
|
|
26386
|
+
if (typeof str2 == "number") return `${str2}`;
|
|
26387
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
26388
26388
|
}
|
|
26389
26389
|
exports.escapeJsonPointer = escapeJsonPointer;
|
|
26390
|
-
function unescapeJsonPointer(
|
|
26391
|
-
return
|
|
26390
|
+
function unescapeJsonPointer(str2) {
|
|
26391
|
+
return str2.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
26392
26392
|
}
|
|
26393
26393
|
exports.unescapeJsonPointer = unescapeJsonPointer;
|
|
26394
26394
|
function eachItem(xs, f) {
|
|
@@ -27274,8 +27274,8 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin(((exports, modu
|
|
|
27274
27274
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
27275
27275
|
}
|
|
27276
27276
|
}
|
|
27277
|
-
function escapeJsonPtr(
|
|
27278
|
-
return
|
|
27277
|
+
function escapeJsonPtr(str2) {
|
|
27278
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
27279
27279
|
}
|
|
27280
27280
|
}));
|
|
27281
27281
|
var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -28167,9 +28167,9 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
28167
28167
|
isIPV6: false
|
|
28168
28168
|
};
|
|
28169
28169
|
}
|
|
28170
|
-
function findToken(
|
|
28170
|
+
function findToken(str2, token) {
|
|
28171
28171
|
let ind = 0;
|
|
28172
|
-
for (let i = 0; i <
|
|
28172
|
+
for (let i = 0; i < str2.length; i++) if (str2[i] === token) ind++;
|
|
28173
28173
|
return ind;
|
|
28174
28174
|
}
|
|
28175
28175
|
function removeDotSegments(path) {
|
|
@@ -28684,7 +28684,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
28684
28684
|
const util_1 = require_util();
|
|
28685
28685
|
const $dataRefSchema = require_data();
|
|
28686
28686
|
const uri_1 = require_uri();
|
|
28687
|
-
const defaultRegExp = (
|
|
28687
|
+
const defaultRegExp = (str2, flags) => new RegExp(str2, flags);
|
|
28688
28688
|
defaultRegExp.code = "new RegExp";
|
|
28689
28689
|
const META_IGNORE_OPTIONS = [
|
|
28690
28690
|
"removeAdditional",
|
|
@@ -29390,16 +29390,16 @@ var require_multipleOf = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29390
29390
|
}));
|
|
29391
29391
|
var require_ucs2length = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
29392
29392
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29393
|
-
function ucs2length(
|
|
29394
|
-
const len =
|
|
29393
|
+
function ucs2length(str2) {
|
|
29394
|
+
const len = str2.length;
|
|
29395
29395
|
let length = 0;
|
|
29396
29396
|
let pos2 = 0;
|
|
29397
29397
|
let value;
|
|
29398
29398
|
while (pos2 < len) {
|
|
29399
29399
|
length++;
|
|
29400
|
-
value =
|
|
29400
|
+
value = str2.charCodeAt(pos2++);
|
|
29401
29401
|
if (value >= 55296 && value <= 56319 && pos2 < len) {
|
|
29402
|
-
value =
|
|
29402
|
+
value = str2.charCodeAt(pos2);
|
|
29403
29403
|
if ((value & 64512) === 56320) pos2++;
|
|
29404
29404
|
}
|
|
29405
29405
|
}
|
|
@@ -32110,8 +32110,8 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32110
32110
|
30,
|
|
32111
32111
|
31
|
|
32112
32112
|
];
|
|
32113
|
-
function date5(
|
|
32114
|
-
const matches = DATE.exec(
|
|
32113
|
+
function date5(str2) {
|
|
32114
|
+
const matches = DATE.exec(str2);
|
|
32115
32115
|
if (!matches) return false;
|
|
32116
32116
|
const year = +matches[1];
|
|
32117
32117
|
const month = +matches[2];
|
|
@@ -32126,8 +32126,8 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32126
32126
|
}
|
|
32127
32127
|
const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
32128
32128
|
function getTime(strictTimeZone) {
|
|
32129
|
-
return function time3(
|
|
32130
|
-
const matches = TIME.exec(
|
|
32129
|
+
return function time3(str2) {
|
|
32130
|
+
const matches = TIME.exec(str2);
|
|
32131
32131
|
if (!matches) return false;
|
|
32132
32132
|
const hr = +matches[1];
|
|
32133
32133
|
const min = +matches[2];
|
|
@@ -32164,8 +32164,8 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32164
32164
|
const DATE_TIME_SEPARATOR = /t|\s/i;
|
|
32165
32165
|
function getDateTime(strictTimeZone) {
|
|
32166
32166
|
const time3 = getTime(strictTimeZone);
|
|
32167
|
-
return function date_time(
|
|
32168
|
-
const dateTime =
|
|
32167
|
+
return function date_time(str2) {
|
|
32168
|
+
const dateTime = str2.split(DATE_TIME_SEPARATOR);
|
|
32169
32169
|
return dateTime.length === 2 && date5(dateTime[0]) && time3(dateTime[1]);
|
|
32170
32170
|
};
|
|
32171
32171
|
}
|
|
@@ -32186,13 +32186,13 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32186
32186
|
}
|
|
32187
32187
|
const NOT_URI_FRAGMENT = /\/|:/;
|
|
32188
32188
|
const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
32189
|
-
function uri(
|
|
32190
|
-
return NOT_URI_FRAGMENT.test(
|
|
32189
|
+
function uri(str2) {
|
|
32190
|
+
return NOT_URI_FRAGMENT.test(str2) && URI.test(str2);
|
|
32191
32191
|
}
|
|
32192
32192
|
const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
32193
|
-
function byte(
|
|
32193
|
+
function byte(str2) {
|
|
32194
32194
|
BYTE.lastIndex = 0;
|
|
32195
|
-
return BYTE.test(
|
|
32195
|
+
return BYTE.test(str2);
|
|
32196
32196
|
}
|
|
32197
32197
|
const MIN_INT32 = -(2 ** 31);
|
|
32198
32198
|
const MAX_INT32 = 2 ** 31 - 1;
|
|
@@ -32206,10 +32206,10 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32206
32206
|
return true;
|
|
32207
32207
|
}
|
|
32208
32208
|
const Z_ANCHOR = /[^\\]\\Z/;
|
|
32209
|
-
function regex(
|
|
32210
|
-
if (Z_ANCHOR.test(
|
|
32209
|
+
function regex(str2) {
|
|
32210
|
+
if (Z_ANCHOR.test(str2)) return false;
|
|
32211
32211
|
try {
|
|
32212
|
-
new RegExp(
|
|
32212
|
+
new RegExp(str2);
|
|
32213
32213
|
return true;
|
|
32214
32214
|
} catch (e) {
|
|
32215
32215
|
return false;
|
|
@@ -35896,6 +35896,7 @@ async function diagnose(err) {
|
|
|
35896
35896
|
const isAuthError = !isTransientError && AUTH_ERROR_PATTERN.test(errText);
|
|
35897
35897
|
const isGridLimitError = GRID_LIMIT_ERROR_PATTERN.test(errText);
|
|
35898
35898
|
const hint = isInvalidGrant ? INVALID_GRANT_HINT : isAuthError ? AUTH_HINT : isTransientError ? TRANSIENT_HINT : isGridLimitError ? GRID_LIMIT_HINT : "";
|
|
35899
|
+
if (!isAuthError && !isInvalidGrant) return errorResult(`${errText}${hint}`);
|
|
35899
35900
|
try {
|
|
35900
35901
|
const accounts = formatAccountList(await run(["auth", "list"]));
|
|
35901
35902
|
return errorResult(`${errText}
|
|
@@ -35999,12 +36000,24 @@ function bodyPreview(text) {
|
|
|
35999
36000
|
}
|
|
36000
36001
|
var CONFIRM_ACTION_INSTRUCTION = CONFIRM_TOKEN_INSTRUCTION;
|
|
36001
36002
|
var CONFIRM_FALLBACK_DESCRIPTION = ' If the client cannot show that prompt (no MCP elicitation, e.g. claude.ai), a two-step flow applies instead: call WITHOUT confirmToken and nothing is sent or changed \u2014 the result has status "confirmation-required", the full preview and a confirmToken. Follow its instruction (by default: show the preview to the user verbatim and only after they explicitly approve it in chat, call again with the SAME arguments plus confirmToken). The tool re-reads what it would act on and refuses (DRAFT_CHANGED, with a fresh preview and token) if it changed; TOKEN_EXPIRED / TOKEN_REUSED / TOKEN_INVALID also do nothing. A server set to MCP_CONFIRM_MODE=refuse refuses instead.';
|
|
36003
|
+
function refusedInRun(what, via, does, instead) {
|
|
36004
|
+
return `${what} ${does} and is not available through ${via}. ${instead}`;
|
|
36005
|
+
}
|
|
36002
36006
|
function gatedElsewhere(what, via, does, tool) {
|
|
36003
|
-
return
|
|
36007
|
+
return refusedInRun(what, via, does, `Use ${tool}, which asks the user to confirm.`);
|
|
36004
36008
|
}
|
|
36005
36009
|
function hasCommandWord(args, words) {
|
|
36006
36010
|
return args.find((a) => words.has(a.toLowerCase()));
|
|
36007
36011
|
}
|
|
36012
|
+
function flagValue(args, name) {
|
|
36013
|
+
const flag = `--${name}`;
|
|
36014
|
+
for (let i = 0; i < args.length; i++) {
|
|
36015
|
+
const a = args[i];
|
|
36016
|
+
if (a === flag) return args[i + 1] ?? "";
|
|
36017
|
+
if (a.startsWith(`${flag}=`)) return a.slice(flag.length + 1);
|
|
36018
|
+
}
|
|
36019
|
+
return void 0;
|
|
36020
|
+
}
|
|
36008
36021
|
async function requireDispatchConfirmation(ctx, options) {
|
|
36009
36022
|
const { action, fallback } = options;
|
|
36010
36023
|
const confirmation = {
|
|
@@ -36165,6 +36178,27 @@ function authToolsFor(defaultServices) {
|
|
|
36165
36178
|
}
|
|
36166
36179
|
|
|
36167
36180
|
// ../gogcli-mcp/src/tools/calendar.ts
|
|
36181
|
+
var ASKS = (tool) => `Use ${tool}, which asks the user to confirm.`;
|
|
36182
|
+
var CALENDAR_REFUSED = {
|
|
36183
|
+
create: { does: "can change what guests see", instead: ASKS("gog_calendar_create") },
|
|
36184
|
+
add: { does: "can change what guests see", instead: ASKS("gog_calendar_create") },
|
|
36185
|
+
new: { does: "can change what guests see", instead: ASKS("gog_calendar_create") },
|
|
36186
|
+
update: { does: "can change what guests see", instead: ASKS("gog_calendar_update") },
|
|
36187
|
+
edit: { does: "can change what guests see", instead: ASKS("gog_calendar_update") },
|
|
36188
|
+
set: { does: "can change what guests see", instead: ASKS("gog_calendar_update") },
|
|
36189
|
+
respond: { does: "can change what guests see", instead: ASKS("gog_calendar_respond") },
|
|
36190
|
+
rsvp: { does: "can change what guests see", instead: ASKS("gog_calendar_respond") },
|
|
36191
|
+
reply: { does: "can change what guests see", instead: ASKS("gog_calendar_respond") },
|
|
36192
|
+
move: { does: "moves an event off guests' calendars (and can email them)", instead: ASKS("gog_calendar_move") },
|
|
36193
|
+
transfer: { does: "moves an event off guests' calendars (and can email them)", instead: ASKS("gog_calendar_move") },
|
|
36194
|
+
delete: { does: "removes an event from every guest's calendar (the whole series by default)", instead: ASKS("gog_calendar_delete") },
|
|
36195
|
+
del: { does: "removes an event from every guest's calendar (the whole series by default)", instead: ASKS("gog_calendar_delete") },
|
|
36196
|
+
rm: { does: "removes an event from every guest's calendar (the whole series by default)", instead: ASKS("gog_calendar_delete") },
|
|
36197
|
+
remove: { does: "removes an event from every guest's calendar (the whole series by default)", instead: ASKS("gog_calendar_delete") },
|
|
36198
|
+
"delete-calendar": { does: "deletes a calendar and every event on it", instead: ASKS("gog_calendar_delete_calendar") },
|
|
36199
|
+
"out-of-office": { does: "auto-declines invitations and notifies their organizers", instead: ASKS("gog_calendar_out_of_office") },
|
|
36200
|
+
ooo: { does: "auto-declines invitations and notifies their organizers", instead: ASKS("gog_calendar_out_of_office") }
|
|
36201
|
+
};
|
|
36168
36202
|
var reminderParams = {
|
|
36169
36203
|
reminders: external_exports.array(external_exports.string()).max(5).optional().describe(
|
|
36170
36204
|
`Reminders as method:duration, e.g. ["popup:30m", "email:1d"]. Method is popup or email; duration accepts m/h/d (max 40320 minutes = 4 weeks). Google allows at most 5. These REPLACE the event's reminders \u2014 on update, pass an EMPTY array to drop custom reminders and go back to the calendar's defaults. Cannot be combined with noReminders.`
|
|
@@ -36196,20 +36230,85 @@ var attachInlineParam = external_exports.array(inlineAttachmentSchema).optional(
|
|
|
36196
36230
|
|
|
36197
36231
|
// ../gogcli-mcp/src/tools/classroom.ts
|
|
36198
36232
|
var CLASSROOM_CREATE_WORDS = /* @__PURE__ */ new Set(["create", "add", "new"]);
|
|
36199
|
-
var
|
|
36200
|
-
|
|
36201
|
-
|
|
36202
|
-
|
|
36203
|
-
|
|
36204
|
-
|
|
36205
|
-
|
|
36233
|
+
var CLASSROOM_DELETE_WORDS = /* @__PURE__ */ new Set(["delete", "rm", "del", "remove"]);
|
|
36234
|
+
var CLASSROOM_UPDATE_WORDS = /* @__PURE__ */ new Set(["update", "edit", "set"]);
|
|
36235
|
+
var CLASSROOM_RETURN_WORDS = /* @__PURE__ */ new Set(["return", "send"]);
|
|
36236
|
+
var CLASSROOM_ASSIGNEE_WORDS = /* @__PURE__ */ new Set(["assignees", "assign"]);
|
|
36237
|
+
var CLASSROOM_GROUPS = {
|
|
36238
|
+
courses: "courses",
|
|
36239
|
+
course: "courses",
|
|
36240
|
+
announcements: "announcements",
|
|
36241
|
+
announcement: "announcements",
|
|
36242
|
+
ann: "announcements",
|
|
36243
|
+
invitations: "invitations",
|
|
36244
|
+
invitation: "invitations",
|
|
36245
|
+
invites: "invitations",
|
|
36246
|
+
coursework: "coursework",
|
|
36247
|
+
work: "coursework",
|
|
36248
|
+
materials: "materials",
|
|
36249
|
+
material: "materials",
|
|
36250
|
+
students: "students",
|
|
36251
|
+
student: "students",
|
|
36252
|
+
teachers: "teachers",
|
|
36253
|
+
teacher: "teachers",
|
|
36254
|
+
submissions: "submissions",
|
|
36255
|
+
submission: "submissions",
|
|
36256
|
+
"guardian-invitations": "guardian-invitations",
|
|
36257
|
+
"guardian-invites": "guardian-invitations"
|
|
36206
36258
|
};
|
|
36259
|
+
function publishesToStudents(args) {
|
|
36260
|
+
return flagValue(args, "state")?.toUpperCase() === "PUBLISHED" || flagValue(args, "scheduled") !== void 0;
|
|
36261
|
+
}
|
|
36262
|
+
function createsVisibleWork(args) {
|
|
36263
|
+
return flagValue(args, "state")?.toUpperCase() !== "DRAFT" || flagValue(args, "scheduled") !== void 0;
|
|
36264
|
+
}
|
|
36265
|
+
function widensAssignees(args) {
|
|
36266
|
+
return flagValue(args, "mode")?.toUpperCase() === "ALL_STUDENTS" || flagValue(args, "add-student") !== void 0;
|
|
36267
|
+
}
|
|
36207
36268
|
function vetClassroomRun(subcommand, args) {
|
|
36208
36269
|
const sub = subcommand.toLowerCase();
|
|
36209
|
-
|
|
36210
|
-
|
|
36211
|
-
const
|
|
36212
|
-
|
|
36270
|
+
if (!Object.hasOwn(CLASSROOM_GROUPS, sub)) return void 0;
|
|
36271
|
+
const group = CLASSROOM_GROUPS[sub];
|
|
36272
|
+
const via = "gog_classroom_run";
|
|
36273
|
+
const what = (word) => `gog classroom ${sub} ${word.toLowerCase()}`;
|
|
36274
|
+
const create = hasCommandWord(args, CLASSROOM_CREATE_WORDS);
|
|
36275
|
+
const update = hasCommandWord(args, CLASSROOM_UPDATE_WORDS);
|
|
36276
|
+
const remove = hasCommandWord(args, CLASSROOM_DELETE_WORDS);
|
|
36277
|
+
const widenedAssignees = () => {
|
|
36278
|
+
const word = hasCommandWord(args, CLASSROOM_ASSIGNEE_WORDS);
|
|
36279
|
+
return word && widensAssignees(args) ? refusedInRun(what(word), via, "shows it to more students", "Ask the user to change who it is assigned to from Classroom.") : void 0;
|
|
36280
|
+
};
|
|
36281
|
+
switch (group) {
|
|
36282
|
+
case "courses":
|
|
36283
|
+
return remove ? gatedElsewhere(what(remove), via, "deletes a course", "gog_classroom_courses_delete") : void 0;
|
|
36284
|
+
case "announcements":
|
|
36285
|
+
if (create) return gatedElsewhere(what(create), via, "posts to a class", "gog_classroom_announcements_create");
|
|
36286
|
+
if (update && publishesToStudents(args)) return gatedElsewhere(what(update), via, "publishes an announcement to a class", "gog_classroom_announcements_update");
|
|
36287
|
+
return widenedAssignees();
|
|
36288
|
+
case "invitations":
|
|
36289
|
+
return create ? gatedElsewhere(what(create), via, "invites someone to a class", "gog_classroom_invitations_create") : void 0;
|
|
36290
|
+
case "coursework":
|
|
36291
|
+
if (create && createsVisibleWork(args)) return gatedElsewhere(what(create), via, "posts coursework to a class", "gog_classroom_coursework_create");
|
|
36292
|
+
if (remove) return gatedElsewhere(what(remove), via, "deletes coursework and every submission to it", "gog_classroom_coursework_delete");
|
|
36293
|
+
if (update && publishesToStudents(args)) return gatedElsewhere(what(update), via, "publishes work to students", "gog_classroom_coursework_update");
|
|
36294
|
+
return widenedAssignees();
|
|
36295
|
+
case "materials":
|
|
36296
|
+
if (create && createsVisibleWork(args)) {
|
|
36297
|
+
return refusedInRun(what(create), via, "publishes material to students", "Create it with --state=DRAFT and no --scheduled; ask the user to publish it from Classroom.");
|
|
36298
|
+
}
|
|
36299
|
+
if (update && publishesToStudents(args)) return refusedInRun(what(update), via, "publishes material to students", "Ask the user to publish it from Classroom.");
|
|
36300
|
+
return void 0;
|
|
36301
|
+
case "students":
|
|
36302
|
+
return create ? gatedElsewhere(what(create), via, "enrols someone in a class", "gog_classroom_students_add") : void 0;
|
|
36303
|
+
case "teachers":
|
|
36304
|
+
return create ? gatedElsewhere(what(create), via, "gives someone a teacher's access to a class and its roster", "gog_classroom_teachers_add") : void 0;
|
|
36305
|
+
case "submissions": {
|
|
36306
|
+
const word = hasCommandWord(args, CLASSROOM_RETURN_WORDS);
|
|
36307
|
+
return word ? gatedElsewhere(what(word), via, "returns work to a student, who is notified", "gog_classroom_submissions_return") : void 0;
|
|
36308
|
+
}
|
|
36309
|
+
case "guardian-invitations":
|
|
36310
|
+
return create ? refusedInRun(what(create), via, "emails a guardian invitation", "Ask the user to invite the guardian from Classroom.") : void 0;
|
|
36311
|
+
}
|
|
36213
36312
|
}
|
|
36214
36313
|
async function readCourse(courseId, account, runner = runOrDiagnose) {
|
|
36215
36314
|
const got = await runner(["classroom", "courses", "get", pos(courseId)], { account });
|
|
@@ -36228,6 +36327,63 @@ async function readCourse(courseId, account, runner = runOrDiagnose) {
|
|
|
36228
36327
|
}
|
|
36229
36328
|
};
|
|
36230
36329
|
}
|
|
36330
|
+
function nested(raw, key) {
|
|
36331
|
+
try {
|
|
36332
|
+
const parsed = JSON.parse(raw);
|
|
36333
|
+
const inner = parsed?.[key];
|
|
36334
|
+
return inner && typeof inner === "object" ? inner : void 0;
|
|
36335
|
+
} catch {
|
|
36336
|
+
return void 0;
|
|
36337
|
+
}
|
|
36338
|
+
}
|
|
36339
|
+
var str = (v) => typeof v === "string" ? v : void 0;
|
|
36340
|
+
var num = (v) => typeof v === "number" ? v : void 0;
|
|
36341
|
+
async function readCoursework(courseId, courseworkId, account, runner = runOrDiagnose) {
|
|
36342
|
+
const got = await runner(["classroom", "coursework", "get", pos(courseId), pos(courseworkId)], { account });
|
|
36343
|
+
if (got.isError) return { error: got };
|
|
36344
|
+
const work = nested(resultText(got), "coursework");
|
|
36345
|
+
const title = str(work?.title);
|
|
36346
|
+
return { coursework: { id: courseworkId, ...title !== void 0 ? { title } : {} } };
|
|
36347
|
+
}
|
|
36348
|
+
async function readClassroomWork(kind, courseId, itemId, account, runner = runOrDiagnose) {
|
|
36349
|
+
const got = await runner(["classroom", kind, "get", pos(courseId), pos(itemId)], { account });
|
|
36350
|
+
if (got.isError) return { error: got };
|
|
36351
|
+
const item = nested(resultText(got), kind === "announcements" ? "announcement" : "coursework");
|
|
36352
|
+
const work = { id: itemId };
|
|
36353
|
+
for (const key of ["text", "title", "description", "state", "updateTime"]) {
|
|
36354
|
+
const value = str(item?.[key]);
|
|
36355
|
+
if (value !== void 0) work[key] = value;
|
|
36356
|
+
}
|
|
36357
|
+
return { work };
|
|
36358
|
+
}
|
|
36359
|
+
async function readSubmission(courseId, courseworkId, submissionId, account, runner = runOrDiagnose) {
|
|
36360
|
+
const got = await runner(["classroom", "submissions", "get", pos(courseId), pos(courseworkId), pos(submissionId)], { account });
|
|
36361
|
+
if (got.isError) return { error: got };
|
|
36362
|
+
const sub = nested(resultText(got), "submission");
|
|
36363
|
+
const fields = {
|
|
36364
|
+
student: str(sub?.userId),
|
|
36365
|
+
state: str(sub?.state),
|
|
36366
|
+
draftGrade: num(sub?.draftGrade),
|
|
36367
|
+
assignedGrade: num(sub?.assignedGrade)
|
|
36368
|
+
};
|
|
36369
|
+
const updateTime = str(sub?.updateTime);
|
|
36370
|
+
return {
|
|
36371
|
+
submission: {
|
|
36372
|
+
id: submissionId,
|
|
36373
|
+
...Object.fromEntries(Object.entries(fields).filter(([, v]) => v !== void 0))
|
|
36374
|
+
},
|
|
36375
|
+
...updateTime !== void 0 ? { updateTime } : {}
|
|
36376
|
+
};
|
|
36377
|
+
}
|
|
36378
|
+
async function studentLabel(courseId, userId, account, runner = runOrDiagnose) {
|
|
36379
|
+
const got = await runner(["classroom", "students", "get", pos(courseId), pos(userId)], { account });
|
|
36380
|
+
if (got.isError) return userId;
|
|
36381
|
+
const profile = nested(resultText(got), "student")?.profile;
|
|
36382
|
+
const name = str(profile?.name?.fullName);
|
|
36383
|
+
const email3 = str(profile?.emailAddress);
|
|
36384
|
+
if (name && email3) return `${name} <${email3}>`;
|
|
36385
|
+
return name ?? email3 ?? userId;
|
|
36386
|
+
}
|
|
36231
36387
|
function registerClassroomTools(server) {
|
|
36232
36388
|
server.registerTool("gog_classroom_courses_list", {
|
|
36233
36389
|
description: "List Google Classroom courses.",
|
|
@@ -36440,15 +36596,38 @@ function registerClassroomTools(server) {
|
|
|
36440
36596
|
return runOrDiagnose(args, { account });
|
|
36441
36597
|
});
|
|
36442
36598
|
server.registerTool("gog_classroom_submissions_return", {
|
|
36443
|
-
description: "Return a graded submission to the student.",
|
|
36599
|
+
description: "Return a graded submission to the student, who is notified and sees the grade. Reads the course, the coursework and the submission and asks the MCP host to show the user a confirmation prompt with the class, the assignment, the student and the grade being returned; nothing is returned unless they accept." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
36444
36600
|
annotations: { destructiveHint: true },
|
|
36445
36601
|
inputSchema: external_exports.object({
|
|
36446
36602
|
courseId: external_exports.string().describe("Course ID"),
|
|
36447
36603
|
courseworkId: external_exports.string().describe("Coursework ID"),
|
|
36448
36604
|
submissionId: external_exports.string().describe("Submission ID"),
|
|
36449
|
-
account: accountParam
|
|
36605
|
+
account: accountParam,
|
|
36606
|
+
confirmToken: confirmTokenParam
|
|
36450
36607
|
})
|
|
36451
|
-
}, async ({ courseId, courseworkId, submissionId, account }) => {
|
|
36608
|
+
}, async ({ courseId, courseworkId, submissionId, account, confirmToken }, ctx) => {
|
|
36609
|
+
const course = await readCourse(courseId, account);
|
|
36610
|
+
if (course.error) return course.error;
|
|
36611
|
+
const work = await readCoursework(courseId, courseworkId, account);
|
|
36612
|
+
if (work.error) return work.error;
|
|
36613
|
+
const sub = await readSubmission(courseId, courseworkId, submissionId, account);
|
|
36614
|
+
if (sub.error) return sub.error;
|
|
36615
|
+
const submission = sub.submission.student ? { ...sub.submission, student: await studentLabel(courseId, sub.submission.student, account) } : sub.submission;
|
|
36616
|
+
const view = { course: course.course, coursework: work.coursework, submission };
|
|
36617
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
36618
|
+
action: "classroom.submission-return",
|
|
36619
|
+
message: "Review and confirm returning this work \u2014 the student is notified and sees the grade:",
|
|
36620
|
+
confirmationLabel: "Confirm that this submission should be returned to the student now.",
|
|
36621
|
+
details: view,
|
|
36622
|
+
unsupportedNote: "Ask the user to return it from Classroom.",
|
|
36623
|
+
fallback: {
|
|
36624
|
+
tool: "gog_classroom_submissions_return",
|
|
36625
|
+
account,
|
|
36626
|
+
confirmToken,
|
|
36627
|
+
subject: () => ({ target: `${courseId}/${courseworkId}/${submissionId}`, revision: sub.updateTime, payload: view, preview: view })
|
|
36628
|
+
}
|
|
36629
|
+
});
|
|
36630
|
+
if (confirmation) return confirmation;
|
|
36452
36631
|
return runOrDiagnose(["classroom", "submissions", "return", pos(courseId), pos(courseworkId), pos(submissionId)], { account });
|
|
36453
36632
|
});
|
|
36454
36633
|
server.registerTool("gog_classroom_submissions_turn_in", {
|
|
@@ -36510,13 +36689,13 @@ function registerClassroomTools(server) {
|
|
|
36510
36689
|
return runOrDiagnose(["classroom", "announcements", "get", pos(courseId), pos(announcementId)], { account });
|
|
36511
36690
|
});
|
|
36512
36691
|
server.registerTool("gog_classroom_announcements_create", {
|
|
36513
|
-
description: "Create an announcement in a Google Classroom course. Unless state is DRAFT (which students cannot see), this reads the course and asks the MCP host to show the user a confirmation prompt with the class, the full text and when it publishes; nothing is posted unless they accept. To stage one without asking, pass state DRAFT." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
36692
|
+
description: "Create an announcement in a Google Classroom course. Unless state is DRAFT with no scheduled time (which students cannot see; a scheduled draft publishes itself), this reads the course and asks the MCP host to show the user a confirmation prompt with the class, the full text and when it publishes; nothing is posted unless they accept. To stage one without asking, pass state DRAFT and no scheduled time." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
36514
36693
|
annotations: { destructiveHint: true },
|
|
36515
36694
|
inputSchema: external_exports.object({
|
|
36516
36695
|
courseId: external_exports.string().describe("Course ID"),
|
|
36517
36696
|
text: external_exports.string().describe("Announcement text"),
|
|
36518
|
-
state: external_exports.enum(["PUBLISHED", "DRAFT"]).optional().describe("State (DRAFT is visible only to teachers and needs no confirmation)"),
|
|
36519
|
-
scheduled: external_exports.string().optional().describe("Scheduled publish time"),
|
|
36697
|
+
state: external_exports.enum(["PUBLISHED", "DRAFT"]).optional().describe("State (an unscheduled DRAFT is visible only to teachers and needs no confirmation)"),
|
|
36698
|
+
scheduled: external_exports.string().optional().describe("Scheduled publish time (asks the user to confirm, even for a DRAFT)"),
|
|
36520
36699
|
account: accountParam,
|
|
36521
36700
|
confirmToken: confirmTokenParam
|
|
36522
36701
|
})
|
|
@@ -36524,7 +36703,7 @@ function registerClassroomTools(server) {
|
|
|
36524
36703
|
const args = ["classroom", "announcements", "create", pos(courseId), `--text=${text}`];
|
|
36525
36704
|
if (state) args.push(`--state=${state}`);
|
|
36526
36705
|
if (scheduled) args.push(`--scheduled=${scheduled}`);
|
|
36527
|
-
if (state !== "DRAFT") {
|
|
36706
|
+
if (state !== "DRAFT" || scheduled) {
|
|
36528
36707
|
const read = await readCourse(courseId, account);
|
|
36529
36708
|
if (read.error) return read.error;
|
|
36530
36709
|
const publishes = scheduled ? `at ${scheduled}` : "immediately";
|
|
@@ -36673,7 +36852,7 @@ var failIfNotEmptyParam = external_exports.boolean().optional().describe(
|
|
|
36673
36852
|
);
|
|
36674
36853
|
|
|
36675
36854
|
// ../gogcli-mcp/src/server.ts
|
|
36676
|
-
var VERSION = true ? "4.5.
|
|
36855
|
+
var VERSION = true ? "4.5.1" : "0.0.0";
|
|
36677
36856
|
|
|
36678
36857
|
// ../gogcli-mcp/src/bootstrap-auth.ts
|
|
36679
36858
|
import { join as join5 } from "node:path";
|
|
@@ -36751,6 +36930,11 @@ var MAX_BLOB_UPLOAD_BYTES = 100 * 1024 * 1024;
|
|
|
36751
36930
|
var courseState = external_exports.enum(["ACTIVE", "ARCHIVED", "PROVISIONED", "DECLINED", "SUSPENDED"]);
|
|
36752
36931
|
var workState = external_exports.enum(["PUBLISHED", "DRAFT"]);
|
|
36753
36932
|
var workType = external_exports.enum(["ASSIGNMENT", "SHORT_ANSWER_QUESTION", "MULTIPLE_CHOICE_QUESTION"]);
|
|
36933
|
+
function publishesWhen(state, scheduled) {
|
|
36934
|
+
if (scheduled) return `at ${scheduled}`;
|
|
36935
|
+
return state === "PUBLISHED" ? "immediately" : void 0;
|
|
36936
|
+
}
|
|
36937
|
+
var PUBLISH_DESCRIPTION = " Publishing it (state PUBLISHED, or a scheduled time) reads the course and the item and asks the MCP host to show the user a confirmation prompt with the class and what students will see; nothing is published unless they accept. Other edits, and a return to DRAFT, need no confirmation." + CONFIRM_FALLBACK_DESCRIPTION;
|
|
36754
36938
|
var courseSharedFields = {
|
|
36755
36939
|
owner: external_exports.string().optional().describe('Owner user ID (default "me" on create)'),
|
|
36756
36940
|
section: external_exports.string().optional().describe("Section"),
|
|
@@ -36810,13 +36994,31 @@ function registerExtraClassroomTools(server) {
|
|
|
36810
36994
|
return runOrDiagnose(args, { account });
|
|
36811
36995
|
});
|
|
36812
36996
|
server.registerTool("gog_classroom_courses_delete", {
|
|
36813
|
-
description: "Delete a Google Classroom course.",
|
|
36997
|
+
description: "Delete a Google Classroom course \u2014 its coursework, submissions and grades go with it, for good. Reads the course and asks the MCP host to show the user a confirmation prompt naming it first; nothing is deleted unless they accept. gog_classroom_courses_archive is the reversible alternative." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
36814
36998
|
annotations: { destructiveHint: true },
|
|
36815
36999
|
inputSchema: external_exports.object({
|
|
36816
37000
|
courseId: external_exports.string().describe("Course ID"),
|
|
36817
|
-
account: accountParam
|
|
37001
|
+
account: accountParam,
|
|
37002
|
+
confirmToken: confirmTokenParam
|
|
36818
37003
|
})
|
|
36819
|
-
}, async ({ courseId, account }) => {
|
|
37004
|
+
}, async ({ courseId, account, confirmToken }, ctx) => {
|
|
37005
|
+
const read = await readCourse(courseId, account, runOrDiagnose);
|
|
37006
|
+
if (read.error) return read.error;
|
|
37007
|
+
const view = { course: read.course, deletes: "the course with all of its coursework, submissions and grades, for good" };
|
|
37008
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
37009
|
+
action: "classroom.course-delete",
|
|
37010
|
+
message: "Review and confirm PERMANENTLY deleting this course:",
|
|
37011
|
+
confirmationLabel: "Confirm that this course should be deleted now.",
|
|
37012
|
+
details: view,
|
|
37013
|
+
unsupportedNote: "Archive it with gog_classroom_courses_archive instead, or ask the user to delete it from Classroom.",
|
|
37014
|
+
fallback: {
|
|
37015
|
+
tool: "gog_classroom_courses_delete",
|
|
37016
|
+
account,
|
|
37017
|
+
confirmToken,
|
|
37018
|
+
subject: () => ({ target: courseId, payload: view, preview: view })
|
|
37019
|
+
}
|
|
37020
|
+
});
|
|
37021
|
+
if (confirmation) return confirmation;
|
|
36820
37022
|
return runOrDiagnose(["classroom", "courses", "delete", pos(courseId), "--force"], { account });
|
|
36821
37023
|
});
|
|
36822
37024
|
server.registerTool("gog_classroom_courses_archive", {
|
|
@@ -36840,17 +37042,37 @@ function registerExtraClassroomTools(server) {
|
|
|
36840
37042
|
return runOrDiagnose(["classroom", "courses", "unarchive", pos(courseId)], { account });
|
|
36841
37043
|
});
|
|
36842
37044
|
server.registerTool("gog_classroom_students_add", {
|
|
36843
|
-
description:
|
|
37045
|
+
description: 'Add a student to a Google Classroom course. Adding someone else gives them the class stream and materials, so this reads the course and asks the MCP host to show the user a confirmation prompt with the class and the student first; enrolling yourself ("me") does not ask.' + CONFIRM_FALLBACK_DESCRIPTION,
|
|
36844
37046
|
annotations: { destructiveHint: true },
|
|
36845
37047
|
inputSchema: external_exports.object({
|
|
36846
37048
|
courseId: external_exports.string().describe("Course ID"),
|
|
36847
|
-
userId: external_exports.string().describe('Student user ID (or "me")'),
|
|
37049
|
+
userId: external_exports.string().describe('Student user ID or email (or "me")'),
|
|
36848
37050
|
enrollmentCode: external_exports.string().optional().describe("Enrollment code (required if adding self via code)"),
|
|
36849
|
-
account: accountParam
|
|
37051
|
+
account: accountParam,
|
|
37052
|
+
confirmToken: confirmTokenParam
|
|
36850
37053
|
})
|
|
36851
|
-
}, async ({ courseId, userId, enrollmentCode, account }) => {
|
|
37054
|
+
}, async ({ courseId, userId, enrollmentCode, account, confirmToken }, ctx) => {
|
|
36852
37055
|
const args = ["classroom", "students", "add", pos(courseId), pos(userId)];
|
|
36853
37056
|
if (enrollmentCode) args.push(`--enrollment-code=${enrollmentCode}`);
|
|
37057
|
+
if (userId.toLowerCase() !== "me") {
|
|
37058
|
+
const read = await readCourse(courseId, account, runOrDiagnose);
|
|
37059
|
+
if (read.error) return read.error;
|
|
37060
|
+
const view = { course: read.course, student: userId };
|
|
37061
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
37062
|
+
action: "classroom.student-add",
|
|
37063
|
+
message: "Review and confirm adding this student to the class:",
|
|
37064
|
+
confirmationLabel: "Confirm that this person should be added to the class now.",
|
|
37065
|
+
details: view,
|
|
37066
|
+
unsupportedNote: "Ask the user to add them from Classroom, or invite them with gog_classroom_invitations_create.",
|
|
37067
|
+
fallback: {
|
|
37068
|
+
tool: "gog_classroom_students_add",
|
|
37069
|
+
account,
|
|
37070
|
+
confirmToken,
|
|
37071
|
+
subject: () => ({ target: `${courseId}/${userId}`, payload: view, preview: view })
|
|
37072
|
+
}
|
|
37073
|
+
});
|
|
37074
|
+
if (confirmation) return confirmation;
|
|
37075
|
+
}
|
|
36854
37076
|
return runOrDiagnose(args, { account });
|
|
36855
37077
|
});
|
|
36856
37078
|
server.registerTool("gog_classroom_students_remove", {
|
|
@@ -36865,14 +37087,32 @@ function registerExtraClassroomTools(server) {
|
|
|
36865
37087
|
return runOrDiagnose(["classroom", "students", "remove", pos(courseId), pos(userId), "--force"], { account });
|
|
36866
37088
|
});
|
|
36867
37089
|
server.registerTool("gog_classroom_teachers_add", {
|
|
36868
|
-
description: "Add a teacher to a Google Classroom course.",
|
|
37090
|
+
description: "Add a teacher to a Google Classroom course. A co-teacher sees every student's work and grades, so this reads the course and asks the MCP host to show the user a confirmation prompt with the class and the teacher first; nothing changes unless they accept." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
36869
37091
|
annotations: { destructiveHint: true },
|
|
36870
37092
|
inputSchema: external_exports.object({
|
|
36871
37093
|
courseId: external_exports.string().describe("Course ID"),
|
|
36872
|
-
userId: external_exports.string().describe("Teacher user ID"),
|
|
36873
|
-
account: accountParam
|
|
37094
|
+
userId: external_exports.string().describe("Teacher user ID or email"),
|
|
37095
|
+
account: accountParam,
|
|
37096
|
+
confirmToken: confirmTokenParam
|
|
36874
37097
|
})
|
|
36875
|
-
}, async ({ courseId, userId, account }) => {
|
|
37098
|
+
}, async ({ courseId, userId, account, confirmToken }, ctx) => {
|
|
37099
|
+
const read = await readCourse(courseId, account, runOrDiagnose);
|
|
37100
|
+
if (read.error) return read.error;
|
|
37101
|
+
const view = { course: read.course, teacher: userId, grants: "teacher access: every student's work, grades and roster" };
|
|
37102
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
37103
|
+
action: "classroom.teacher-add",
|
|
37104
|
+
message: "Review and confirm giving this person teacher access to the class:",
|
|
37105
|
+
confirmationLabel: "Confirm that this person should become a teacher of the class now.",
|
|
37106
|
+
details: view,
|
|
37107
|
+
unsupportedNote: "Ask the user to add them from Classroom, or invite them with gog_classroom_invitations_create.",
|
|
37108
|
+
fallback: {
|
|
37109
|
+
tool: "gog_classroom_teachers_add",
|
|
37110
|
+
account,
|
|
37111
|
+
confirmToken,
|
|
37112
|
+
subject: () => ({ target: `${courseId}/${userId}`, payload: view, preview: view })
|
|
37113
|
+
}
|
|
37114
|
+
});
|
|
37115
|
+
if (confirmation) return confirmation;
|
|
36876
37116
|
return runOrDiagnose(["classroom", "teachers", "add", pos(courseId), pos(userId)], { account });
|
|
36877
37117
|
});
|
|
36878
37118
|
server.registerTool("gog_classroom_teachers_remove", {
|
|
@@ -36887,15 +37127,16 @@ function registerExtraClassroomTools(server) {
|
|
|
36887
37127
|
return runOrDiagnose(["classroom", "teachers", "remove", pos(courseId), pos(userId), "--force"], { account });
|
|
36888
37128
|
});
|
|
36889
37129
|
server.registerTool("gog_classroom_coursework_create", {
|
|
36890
|
-
description: "Create a new coursework item (assignment, question, etc.) in a course.",
|
|
37130
|
+
description: "Create a new coursework item (assignment, question, etc.) in a course. Unless state is DRAFT with no scheduled time (which students cannot see; a scheduled draft publishes itself), the class is notified, so this reads the course and asks the MCP host to show the user a confirmation prompt with the class, the title, the text, the due date and when it publishes; nothing is posted unless they accept. To stage one without asking, pass state DRAFT and no scheduled time." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
36891
37131
|
annotations: { destructiveHint: true },
|
|
36892
37132
|
inputSchema: external_exports.object({
|
|
36893
37133
|
courseId: external_exports.string().describe("Course ID"),
|
|
36894
37134
|
title: external_exports.string().describe("Coursework title"),
|
|
36895
37135
|
...courseworkSharedFields,
|
|
36896
|
-
account: accountParam
|
|
37136
|
+
account: accountParam,
|
|
37137
|
+
confirmToken: confirmTokenParam
|
|
36897
37138
|
})
|
|
36898
|
-
}, async ({ courseId, title, description, type, state, maxPoints, due, dueDate, dueTime, scheduled, topic, account }) => {
|
|
37139
|
+
}, async ({ courseId, title, description, type, state, maxPoints, due, dueDate, dueTime, scheduled, topic, account, confirmToken }, ctx) => {
|
|
36899
37140
|
const args = ["classroom", "coursework", "create", pos(courseId), `--title=${title}`];
|
|
36900
37141
|
if (description) args.push(`--description=${description}`);
|
|
36901
37142
|
if (type) args.push(`--type=${type}`);
|
|
@@ -36906,19 +37147,49 @@ function registerExtraClassroomTools(server) {
|
|
|
36906
37147
|
if (dueTime) args.push(`--due-time=${dueTime}`);
|
|
36907
37148
|
if (scheduled) args.push(`--scheduled=${scheduled}`);
|
|
36908
37149
|
if (topic) args.push(`--topic=${topic}`);
|
|
37150
|
+
if (state !== "DRAFT" || scheduled) {
|
|
37151
|
+
const read = await readCourse(courseId, account, runOrDiagnose);
|
|
37152
|
+
if (read.error) return read.error;
|
|
37153
|
+
const work = {
|
|
37154
|
+
course: read.course,
|
|
37155
|
+
title,
|
|
37156
|
+
type: type ?? "ASSIGNMENT",
|
|
37157
|
+
publishes: scheduled ? `at ${scheduled}` : "immediately",
|
|
37158
|
+
due: due ?? ([dueDate, dueTime].filter(Boolean).join(" ") || void 0),
|
|
37159
|
+
maxPoints
|
|
37160
|
+
};
|
|
37161
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
37162
|
+
action: "classroom.coursework-create",
|
|
37163
|
+
message: "Review and confirm posting this coursework to the class:",
|
|
37164
|
+
confirmationLabel: "Confirm that this coursework should be posted to the class.",
|
|
37165
|
+
details: { ...work, descriptionPreview: bodyPreview(description) },
|
|
37166
|
+
unsupportedNote: "Create it with state DRAFT instead; the user can review and post it from Classroom.",
|
|
37167
|
+
fallback: {
|
|
37168
|
+
tool: "gog_classroom_coursework_create",
|
|
37169
|
+
account,
|
|
37170
|
+
confirmToken,
|
|
37171
|
+
subject: () => {
|
|
37172
|
+
const view = { ...work, description };
|
|
37173
|
+
return { target: courseId, payload: view, preview: view };
|
|
37174
|
+
}
|
|
37175
|
+
}
|
|
37176
|
+
});
|
|
37177
|
+
if (confirmation) return confirmation;
|
|
37178
|
+
}
|
|
36909
37179
|
return runOrDiagnose(args, { account });
|
|
36910
37180
|
});
|
|
36911
37181
|
server.registerTool("gog_classroom_coursework_update", {
|
|
36912
|
-
description: "Update an existing coursework item.",
|
|
37182
|
+
description: "Update an existing coursework item." + PUBLISH_DESCRIPTION,
|
|
36913
37183
|
annotations: { destructiveHint: true },
|
|
36914
37184
|
inputSchema: external_exports.object({
|
|
36915
37185
|
courseId: external_exports.string().describe("Course ID"),
|
|
36916
37186
|
courseworkId: external_exports.string().describe("Coursework ID"),
|
|
36917
37187
|
title: external_exports.string().optional().describe("New title"),
|
|
36918
37188
|
...courseworkSharedFields,
|
|
36919
|
-
account: accountParam
|
|
37189
|
+
account: accountParam,
|
|
37190
|
+
confirmToken: confirmTokenParam
|
|
36920
37191
|
})
|
|
36921
|
-
}, async ({ courseId, courseworkId, title, description, type, state, maxPoints, due, dueDate, dueTime, scheduled, topic, account }) => {
|
|
37192
|
+
}, async ({ courseId, courseworkId, title, description, type, state, maxPoints, due, dueDate, dueTime, scheduled, topic, account, confirmToken }, ctx) => {
|
|
36922
37193
|
const args = ["classroom", "coursework", "update", pos(courseId), pos(courseworkId)];
|
|
36923
37194
|
if (title) args.push(`--title=${title}`);
|
|
36924
37195
|
if (description) args.push(`--description=${description}`);
|
|
@@ -36930,35 +37201,123 @@ function registerExtraClassroomTools(server) {
|
|
|
36930
37201
|
if (dueTime) args.push(`--due-time=${dueTime}`);
|
|
36931
37202
|
if (scheduled) args.push(`--scheduled=${scheduled}`);
|
|
36932
37203
|
if (topic) args.push(`--topic=${topic}`);
|
|
37204
|
+
const publishes = publishesWhen(state, scheduled);
|
|
37205
|
+
if (publishes) {
|
|
37206
|
+
const read = await readCourse(courseId, account, runOrDiagnose);
|
|
37207
|
+
if (read.error) return read.error;
|
|
37208
|
+
const current = await readClassroomWork("coursework", courseId, courseworkId, account, runOrDiagnose);
|
|
37209
|
+
if (current.error) return current.error;
|
|
37210
|
+
const published = description || current.work.description;
|
|
37211
|
+
const publishedTitle = title || current.work.title;
|
|
37212
|
+
const view = {
|
|
37213
|
+
course: read.course,
|
|
37214
|
+
coursework: { id: courseworkId, title: publishedTitle, state: current.work.state },
|
|
37215
|
+
publishes,
|
|
37216
|
+
descriptionPreview: bodyPreview(published)
|
|
37217
|
+
};
|
|
37218
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
37219
|
+
action: "classroom.coursework-publish",
|
|
37220
|
+
message: "Review and confirm publishing this Classroom coursework to students:",
|
|
37221
|
+
confirmationLabel: "Confirm that this coursework should be published to the class.",
|
|
37222
|
+
details: view,
|
|
37223
|
+
unsupportedNote: "Leave it as a DRAFT; the user can review and publish it from Classroom.",
|
|
37224
|
+
fallback: {
|
|
37225
|
+
tool: "gog_classroom_coursework_update",
|
|
37226
|
+
account,
|
|
37227
|
+
confirmToken,
|
|
37228
|
+
subject: () => ({
|
|
37229
|
+
target: `${courseId}/${courseworkId}`,
|
|
37230
|
+
revision: current.work.updateTime,
|
|
37231
|
+
payload: { course: read.course, courseworkId, title: publishedTitle, description: published, type, state, maxPoints, due, dueDate, dueTime, scheduled, topic },
|
|
37232
|
+
preview: view
|
|
37233
|
+
})
|
|
37234
|
+
}
|
|
37235
|
+
});
|
|
37236
|
+
if (confirmation) return confirmation;
|
|
37237
|
+
}
|
|
36933
37238
|
return runOrDiagnose(args, { account });
|
|
36934
37239
|
});
|
|
36935
37240
|
server.registerTool("gog_classroom_coursework_delete", {
|
|
36936
|
-
description: "Delete a coursework item.",
|
|
37241
|
+
description: "Delete a coursework item \u2014 every student submission to it goes too, for good. Reads the course and the coursework and asks the MCP host to show the user a confirmation prompt naming both first; nothing is deleted unless they accept." + CONFIRM_FALLBACK_DESCRIPTION,
|
|
36937
37242
|
annotations: { destructiveHint: true },
|
|
36938
37243
|
inputSchema: external_exports.object({
|
|
36939
37244
|
courseId: external_exports.string().describe("Course ID"),
|
|
36940
37245
|
courseworkId: external_exports.string().describe("Coursework ID"),
|
|
36941
|
-
account: accountParam
|
|
37246
|
+
account: accountParam,
|
|
37247
|
+
confirmToken: confirmTokenParam
|
|
36942
37248
|
})
|
|
36943
|
-
}, async ({ courseId, courseworkId, account }) => {
|
|
37249
|
+
}, async ({ courseId, courseworkId, account, confirmToken }, ctx) => {
|
|
37250
|
+
const course = await readCourse(courseId, account, runOrDiagnose);
|
|
37251
|
+
if (course.error) return course.error;
|
|
37252
|
+
const work = await readCoursework(courseId, courseworkId, account, runOrDiagnose);
|
|
37253
|
+
if (work.error) return work.error;
|
|
37254
|
+
const view = { course: course.course, coursework: work.coursework, deletes: "the coursework and every student submission to it, for good" };
|
|
37255
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
37256
|
+
action: "classroom.coursework-delete",
|
|
37257
|
+
message: "Review and confirm PERMANENTLY deleting this coursework and its submissions:",
|
|
37258
|
+
confirmationLabel: "Confirm that this coursework should be deleted now.",
|
|
37259
|
+
details: view,
|
|
37260
|
+
unsupportedNote: "Ask the user to delete it from Classroom.",
|
|
37261
|
+
fallback: {
|
|
37262
|
+
tool: "gog_classroom_coursework_delete",
|
|
37263
|
+
account,
|
|
37264
|
+
confirmToken,
|
|
37265
|
+
subject: () => ({ target: `${courseId}/${courseworkId}`, payload: view, preview: view })
|
|
37266
|
+
}
|
|
37267
|
+
});
|
|
37268
|
+
if (confirmation) return confirmation;
|
|
36944
37269
|
return runOrDiagnose(["classroom", "coursework", "delete", pos(courseId), pos(courseworkId), "--force"], { account });
|
|
36945
37270
|
});
|
|
36946
37271
|
server.registerTool("gog_classroom_announcements_update", {
|
|
36947
|
-
description: "Update an existing announcement.",
|
|
37272
|
+
description: "Update an existing announcement." + PUBLISH_DESCRIPTION,
|
|
36948
37273
|
annotations: { destructiveHint: true },
|
|
36949
37274
|
inputSchema: external_exports.object({
|
|
36950
37275
|
courseId: external_exports.string().describe("Course ID"),
|
|
36951
37276
|
announcementId: external_exports.string().describe("Announcement ID"),
|
|
36952
37277
|
text: external_exports.string().optional().describe("New text"),
|
|
36953
|
-
state: workState.optional().describe("State"),
|
|
36954
|
-
scheduled: external_exports.string().optional().describe("Scheduled publish time"),
|
|
36955
|
-
account: accountParam
|
|
37278
|
+
state: workState.optional().describe("State (PUBLISHED asks the user to confirm; DRAFT does not)"),
|
|
37279
|
+
scheduled: external_exports.string().optional().describe("Scheduled publish time (asks the user to confirm)"),
|
|
37280
|
+
account: accountParam,
|
|
37281
|
+
confirmToken: confirmTokenParam
|
|
36956
37282
|
})
|
|
36957
|
-
}, async ({ courseId, announcementId, text, state, scheduled, account }) => {
|
|
37283
|
+
}, async ({ courseId, announcementId, text, state, scheduled, account, confirmToken }, ctx) => {
|
|
36958
37284
|
const args = ["classroom", "announcements", "update", pos(courseId), pos(announcementId)];
|
|
36959
37285
|
if (text) args.push(`--text=${text}`);
|
|
36960
37286
|
if (state) args.push(`--state=${state}`);
|
|
36961
37287
|
if (scheduled) args.push(`--scheduled=${scheduled}`);
|
|
37288
|
+
const publishes = publishesWhen(state, scheduled);
|
|
37289
|
+
if (publishes) {
|
|
37290
|
+
const read = await readCourse(courseId, account, runOrDiagnose);
|
|
37291
|
+
if (read.error) return read.error;
|
|
37292
|
+
const current = await readClassroomWork("announcements", courseId, announcementId, account, runOrDiagnose);
|
|
37293
|
+
if (current.error) return current.error;
|
|
37294
|
+
const published = text || current.work.text;
|
|
37295
|
+
const view = {
|
|
37296
|
+
course: read.course,
|
|
37297
|
+
announcement: { id: announcementId, state: current.work.state },
|
|
37298
|
+
publishes,
|
|
37299
|
+
textPreview: bodyPreview(published)
|
|
37300
|
+
};
|
|
37301
|
+
const confirmation = await requireDispatchConfirmation(ctx, {
|
|
37302
|
+
action: "classroom.announcement-publish",
|
|
37303
|
+
message: "Review and confirm publishing this Classroom announcement to the class:",
|
|
37304
|
+
confirmationLabel: "Confirm that this announcement should be published to the class.",
|
|
37305
|
+
details: view,
|
|
37306
|
+
unsupportedNote: "Leave it as a DRAFT; the user can review and publish it from Classroom.",
|
|
37307
|
+
fallback: {
|
|
37308
|
+
tool: "gog_classroom_announcements_update",
|
|
37309
|
+
account,
|
|
37310
|
+
confirmToken,
|
|
37311
|
+
subject: () => ({
|
|
37312
|
+
target: `${courseId}/${announcementId}`,
|
|
37313
|
+
revision: current.work.updateTime,
|
|
37314
|
+
payload: { course: read.course, announcementId, text: published, state, scheduled },
|
|
37315
|
+
preview: view
|
|
37316
|
+
})
|
|
37317
|
+
}
|
|
37318
|
+
});
|
|
37319
|
+
if (confirmation) return confirmation;
|
|
37320
|
+
}
|
|
36962
37321
|
return runOrDiagnose(args, { account });
|
|
36963
37322
|
});
|
|
36964
37323
|
server.registerTool("gog_classroom_announcements_delete", {
|