@j0hanz/filesystem-mcp 1.6.1 → 1.7.0
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/README.md +19 -17
- package/dist/lib/errors.js +20 -16
- package/dist/lib/file-operations/glob-engine.js +37 -20
- package/dist/lib/fs-helpers.js +7 -8
- package/dist/lib/path-policy.js +30 -14
- package/dist/prompts.js +1 -1
- package/dist/resources/generated-instructions.js +23 -22
- package/dist/resources/tool-catalog.js +2 -2
- package/dist/resources/tool-info.js +1 -1
- package/dist/resources/workflows.js +2 -3
- package/dist/resources.js +3 -3
- package/dist/server/bootstrap.js +1 -6
- package/dist/server/capabilities.js +4 -1
- package/dist/server/roots-manager.d.ts +2 -0
- package/dist/server/roots-manager.js +24 -6
- package/dist/tools/calculate-hash.js +6 -22
- package/dist/tools/read-multiple.js +34 -43
- package/dist/tools/replace-in-files.js +52 -56
- package/dist/tools/search-content.js +6 -27
- package/dist/tools/shared.d.ts +22 -0
- package/dist/tools/shared.js +69 -8
- package/dist/tools/stat-many.js +6 -24
- package/dist/tools/task-support.js +19 -0
- package/package.json +1 -3
|
@@ -134,6 +134,10 @@ function normalizeCallToolResult(value) {
|
|
|
134
134
|
function getToolResultErrorCode(result) {
|
|
135
135
|
if (!isRecord(result) || result['isError'] !== true)
|
|
136
136
|
return undefined;
|
|
137
|
+
// First check for a dedicated errorCode property to avoid regex parsing of the content for structured error results produced by newer code.
|
|
138
|
+
if (typeof result['errorCode'] === 'string')
|
|
139
|
+
return result['errorCode'];
|
|
140
|
+
// Fallback to regex parsing of the human-readable error message for older error results that lack a structured errorCode property.
|
|
137
141
|
const { content } = result;
|
|
138
142
|
if (!Array.isArray(content) || content.length === 0)
|
|
139
143
|
return undefined;
|
|
@@ -293,6 +297,21 @@ async function runTaskInBackground(run, args, extra, taskStore, taskId, toolName
|
|
|
293
297
|
}
|
|
294
298
|
catch (innerError) {
|
|
295
299
|
console.error(`Failed to store task failure result for task ${taskId}:`, innerError);
|
|
300
|
+
// If storing the failure result also fails, there's not much we can do. The task will remain in 'working' status until it expires, which is not ideal but at least prevents clients from receiving incorrect results or hanging indefinitely waiting for a result that will never arrive. We log the error to aid debugging, and we attempt to notify the client of the failure if possible, but we don't want to throw further errors that could crash the server or cause cascading failures.
|
|
301
|
+
const syntheticTask = {
|
|
302
|
+
taskId,
|
|
303
|
+
status: 'failed',
|
|
304
|
+
ttl: null,
|
|
305
|
+
createdAt: new Date().toISOString(),
|
|
306
|
+
lastUpdatedAt: new Date().toISOString(),
|
|
307
|
+
};
|
|
308
|
+
const { sendNotification } = extra;
|
|
309
|
+
if (typeof sendNotification === 'function') {
|
|
310
|
+
void sendNotification({
|
|
311
|
+
method: TASK_STATUS_NOTIFICATION_METHOD,
|
|
312
|
+
params: buildTaskStatusNotificationParams(syntheticTask),
|
|
313
|
+
});
|
|
314
|
+
}
|
|
296
315
|
}
|
|
297
316
|
}
|
|
298
317
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@j0hanz/filesystem-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"mcpName": "io.github.j0hanz/filesystem-mcp",
|
|
5
5
|
"description": "MCP Server that enables LLMs to interact with the local filesystem.",
|
|
6
6
|
"type": "module",
|
|
@@ -37,8 +37,6 @@
|
|
|
37
37
|
"lint": "eslint .",
|
|
38
38
|
"lint:fix": "eslint . --fix",
|
|
39
39
|
"test": "node scripts/tasks.mjs test",
|
|
40
|
-
"test:fast": "node --test --import tsx/esm src/__tests__/**/*.test.ts node-tests/**/*.test.ts",
|
|
41
|
-
"test:coverage": "node scripts/tasks.mjs test --coverage",
|
|
42
40
|
"knip": "knip",
|
|
43
41
|
"knip:fix": "knip --fix",
|
|
44
42
|
"inspector": "npm run build && npx -y @modelcontextprotocol/inspector node dist/index.js ${workspaceFolder}",
|