sad-mcp 0.1.14 → 0.1.15

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.
Files changed (2) hide show
  1. package/dist/tools.js +8 -6
  2. package/package.json +1 -1
package/dist/tools.js CHANGED
@@ -84,7 +84,7 @@ export function registerToolHandlers(server) {
84
84
  properties: {
85
85
  name: {
86
86
  type: "string",
87
- description: "The file name (or partial name) to retrieve. Matched against file names from search_materials or list_materials results.",
87
+ description: "The file name or path (or partial match) to retrieve. Use the path from search_materials results for exact matching (e.g., 'מבחנים-לסטודנטים/2024-א-א/מבחן.pdf').",
88
88
  },
89
89
  page: {
90
90
  type: "number",
@@ -160,6 +160,7 @@ export function registerToolHandlers(server) {
160
160
  if (matches.length > 0 || nameMatch) {
161
161
  results.push({
162
162
  fileName: file.name,
163
+ path: file.path,
163
164
  category: categorizeFile(file),
164
165
  matchCount: nameMatch ? matches.length + 100 : matches.length, // Boost file-name matches
165
166
  preview: matches.length > 0
@@ -176,6 +177,7 @@ export function registerToolHandlers(server) {
176
177
  if (file.name.toLowerCase().includes(queryLower) || file.path.toLowerCase().includes(queryLower)) {
177
178
  results.push({
178
179
  fileName: file.name,
180
+ path: file.path,
179
181
  category: categorizeFile(file),
180
182
  matchCount: 100,
181
183
  preview: `(file name matches "${query}" — use get_material to read)`,
@@ -186,7 +188,7 @@ export function registerToolHandlers(server) {
186
188
  results.sort((a, b) => b.matchCount - a.matchCount);
187
189
  const responseText = results.length === 0
188
190
  ? `No results found for "${query}" in course materials.`
189
- : `Found "${query}" in ${results.length} file(s). Use get_material to read the most relevant one(s):\n\n${results.map((r) => `- ${r.fileName} [${r.category}] (${r.matchCount} matches) — "${r.preview}"`).join("\n")}`;
191
+ : `Found "${query}" in ${results.length} file(s). Use get_material with the file path to read the most relevant one(s):\n\n${results.map((r) => `- ${r.path} [${r.category}] (${r.matchCount} matches) — "${r.preview}"`).join("\n")}`;
190
192
  trackToolCall(name, toolArgs, { resultCount: results.length, success: results.length > 0, responseChars: responseText.length }, Date.now() - startTime);
191
193
  return { content: [{ type: "text", text: responseText }] };
192
194
  }
@@ -199,18 +201,18 @@ export function registerToolHandlers(server) {
199
201
  }
200
202
  await ensureTextCache();
201
203
  const queryLower = queryName.toLowerCase();
202
- // First: check text cache
204
+ // First: check text cache (match against both name and path)
203
205
  let bestMatch = null;
204
206
  for (const [, entry] of textCache) {
205
- if (entry.file.name.toLowerCase().includes(queryLower)) {
207
+ if (entry.file.name.toLowerCase().includes(queryLower) || entry.file.path.toLowerCase().includes(queryLower)) {
206
208
  bestMatch = entry;
207
209
  break;
208
210
  }
209
211
  }
210
- // Fallback: search all files by name and attempt fresh extraction
212
+ // Fallback: search all files by name/path and attempt fresh extraction
211
213
  if (!bestMatch) {
212
214
  const allFiles = await listAllFiles();
213
- const matchedFile = allFiles.find(f => f.name.toLowerCase().includes(queryLower));
215
+ const matchedFile = allFiles.find(f => f.name.toLowerCase().includes(queryLower) || f.path.toLowerCase().includes(queryLower));
214
216
  if (matchedFile && isExtractable(matchedFile)) {
215
217
  try {
216
218
  const buffer = await downloadFile(matchedFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sad-mcp",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "MCP server for Software Analysis and Design course materials at BGU",
5
5
  "type": "module",
6
6
  "bin": {