Skip to content

Commit fc3cd3b

Browse files
committed
fix: await dispatchTool so async rejections are caught by try/catch
Without await, the surrounding catch only handles synchronous throws. Any async rejection from a tool handler (e.g. detectMetadata() I/O failure) would escape as an unhandled MCP error instead of returning the structured JSON error response.
1 parent 6d5026b commit fc3cd3b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
493493
rootPath: ROOT_PATH,
494494
performIndexing
495495
};
496-
return dispatchTool(name, args as Record<string, unknown>, ctx);
496+
return await dispatchTool(name, args as Record<string, unknown>, ctx);
497497
} catch (error) {
498498
return {
499499
content: [

0 commit comments

Comments
 (0)