@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.
@@ -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.6.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}",