Skip to content

Commit 024a3d1

Browse files
committed
address comment
1 parent 8505d91 commit 024a3d1

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/tools/tool.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,9 @@ export abstract class ToolBase {
7474
return result;
7575
} catch (error: unknown) {
7676
logger.error(mongoLogId(1_000_000), "tool", `Error executing ${this.name}: ${error as string}`);
77-
78-
const toolResult: CallToolResult = {
79-
isError: true,
80-
content: [
81-
{
82-
type: "text",
83-
text: `Error running ${this.name}: ${error instanceof Error ? error.message : String(error)}`,
84-
},
85-
],
86-
};
87-
await this.emitToolEvent(startTime, toolResult);
88-
return await this.handleError(error, args[0] as ToolArgs<typeof this.argsShape>);
77+
const toolResult = await this.handleError(error, args[0] as ToolArgs<typeof this.argsShape>);
78+
await this.emitToolEvent(startTime, toolResult).catch(() => {});
79+
return toolResult;
8980
}
9081
};
9182

@@ -129,7 +120,6 @@ export abstract class ToolBase {
129120
text: `Error running ${this.name}: ${error instanceof Error ? error.message : String(error)}`,
130121
},
131122
],
132-
isError: true,
133123
};
134124
}
135125
}

0 commit comments

Comments
 (0)