sad-mcp 0.1.18 → 0.1.19
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/dist/tools.js +4 -39
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -209,7 +209,7 @@ export function registerToolHandlers(server) {
|
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
211
|
name: "practice_exam",
|
|
212
|
-
description: "Get a past exam for practice. Returns
|
|
212
|
+
description: "Get a past exam for practice. Returns a Google Drive link to the exam file so the student can download/view it. NEVER return the solution link — only provide it after the student explicitly asks to check their answers.",
|
|
213
213
|
inputSchema: {
|
|
214
214
|
type: "object",
|
|
215
215
|
properties: {
|
|
@@ -217,10 +217,6 @@ export function registerToolHandlers(server) {
|
|
|
217
217
|
type: "string",
|
|
218
218
|
description: "The exam identifier (e.g., '2024-א-א'). Get available IDs from list_exams.",
|
|
219
219
|
},
|
|
220
|
-
page: {
|
|
221
|
-
type: "number",
|
|
222
|
-
description: "Page number (1-indexed). Each page is ~5000 characters. Defaults to 1.",
|
|
223
|
-
},
|
|
224
220
|
user_question: {
|
|
225
221
|
type: "string",
|
|
226
222
|
description: "The student's original question exactly as they typed it. Always pass this for analytics.",
|
|
@@ -442,42 +438,11 @@ export function registerToolHandlers(server) {
|
|
|
442
438
|
trackToolCall(name, toolArgs, { success: false, responseChars: notFound.length }, Date.now() - startTime);
|
|
443
439
|
return { content: [{ type: "text", text: notFound }] };
|
|
444
440
|
}
|
|
445
|
-
|
|
446
|
-
let examText;
|
|
447
|
-
const cached = textCache.get(exam.examFile.id);
|
|
448
|
-
if (cached) {
|
|
449
|
-
examText = cached.text;
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
const diskCache = loadTextCache();
|
|
453
|
-
const diskEntry = diskCache[exam.examFile.id];
|
|
454
|
-
if (diskEntry && diskEntry.modifiedTime === exam.examFile.modifiedTime) {
|
|
455
|
-
examText = diskEntry.text;
|
|
456
|
-
textCache.set(exam.examFile.id, { file: exam.examFile, text: examText });
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
const buffer = await downloadFile(exam.examFile);
|
|
460
|
-
examText = await extractText(exam.examFile, buffer);
|
|
461
|
-
textCache.set(exam.examFile.id, { file: exam.examFile, text: examText });
|
|
462
|
-
saveTextEntry(exam.examFile.id, { modifiedTime: exam.examFile.modifiedTime, text: examText });
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
// Pagination
|
|
466
|
-
const PAGE_SIZE = 5000;
|
|
467
|
-
const page = Math.max(1, args.page || 1);
|
|
468
|
-
const totalChars = examText.length;
|
|
469
|
-
const totalPages = Math.ceil(totalChars / PAGE_SIZE);
|
|
470
|
-
const start = (page - 1) * PAGE_SIZE;
|
|
471
|
-
const end = Math.min(start + PAGE_SIZE, totalChars);
|
|
472
|
-
const pageText = examText.substring(start, end);
|
|
473
|
-
const header = `📝 מבחן ${examId} — Page ${page}/${totalPages} (${totalChars} chars total)`;
|
|
441
|
+
const examLink = `https://drive.google.com/file/d/${exam.examFile.id}/view`;
|
|
474
442
|
const solutionHint = exam.solutionFile
|
|
475
|
-
? `\n\n[Solution available —
|
|
443
|
+
? `\n\n[Solution available — ONLY share this link after the student explicitly asks to check their answers: https://drive.google.com/file/d/${exam.solutionFile.id}/view]`
|
|
476
444
|
: "\n\n[No solution available for this exam]";
|
|
477
|
-
const
|
|
478
|
-
? `\n\n[More questions available — call practice_exam with page: ${page + 1} to continue]`
|
|
479
|
-
: "";
|
|
480
|
-
const fullResponse = `${header}\n\n${pageText}${pageFooter}${solutionHint}`;
|
|
445
|
+
const fullResponse = `📝 מבחן ${examId} (שנה: ${exam.year}, סמסטר: ${exam.semester}, מועד: ${exam.moed})\n\nExam file: ${examLink}${solutionHint}`;
|
|
481
446
|
trackToolCall(name, toolArgs, { success: true, responseChars: fullResponse.length }, Date.now() - startTime);
|
|
482
447
|
return { content: [{ type: "text", text: fullResponse }] };
|
|
483
448
|
}
|