@j0hanz/filesystem-mcp 1.3.0 → 1.3.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.
@@ -224,6 +224,14 @@ function getTaskId(extra) {
224
224
  function isErrorResult(result) {
225
225
  return 'isError' in result && result.isError === true;
226
226
  }
227
+ // Strips structuredContent from a tool result if present, without modifying the original object. This is used when storing error results as 'completed' to prevent client-side output schema validation errors, while still allowing the human-readable error message in content[0].text to be returned to clients.
228
+ function withoutStructuredContent(result) {
229
+ if (!Object.hasOwn(result, 'structuredContent'))
230
+ return result;
231
+ const stripped = { ...result };
232
+ delete stripped['structuredContent'];
233
+ return stripped;
234
+ }
227
235
  const TERMINAL_TASK_STATUSES = new Set([
228
236
  'completed',
229
237
  'failed',
@@ -254,8 +262,11 @@ async function tryStoreTaskResult(taskStore, taskId, status, result) {
254
262
  }
255
263
  async function runTaskInBackground(run, args, extra, taskStore, taskId, toolName) {
256
264
  try {
257
- const result = maybeStripStructuredContentFromResult(await run(args, extra));
258
- const status = isErrorResult(result) ? 'failed' : 'completed';
265
+ const rawResult = await run(args, extra);
266
+ const status = isCancelledToolResult(rawResult) ? 'failed' : 'completed';
267
+ const result = isErrorResult(rawResult) && status === 'completed'
268
+ ? withoutStructuredContent(rawResult)
269
+ : maybeStripStructuredContentFromResult(rawResult);
259
270
  await tryStoreTaskResult(taskStore, taskId, status, result);
260
271
  publishTaskDiagnostics({
261
272
  phase: 'task_result_stored',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/filesystem-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
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",