Skip to content

Commit f4b8323

Browse files
committed
add log if existingTool is not found
1 parent cb35fdf commit f4b8323

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/logger.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export const LogId = {
3232

3333
mongodbConnectFailure: mongoLogId(1_004_001),
3434
mongodbDisconnectFailure: mongoLogId(1_004_002),
35+
36+
toolUpdateFailure: mongoLogId(1_005_001),
3537
} as const;
3638

3739
abstract class LoggerBase {

src/tools/tool.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ export abstract class ToolBase {
9393
this.update = (updates: { name?: string; description?: string; inputSchema?: AnyZodObject }) => {
9494
const tools = server["_registeredTools"] as { [toolName: string]: RegisteredTool };
9595
const existingTool = tools[this.name];
96+
9697
if (!existingTool) {
97-
// Optionally, throw or log an error here
98+
logger.warning(LogId.toolUpdateFailure, "tool", `Tool ${this.name} not found in update`);
9899
return;
99100
}
101+
100102
existingTool.annotations = this.annotations;
101103

102104
if (updates.name && updates.name !== this.name) {

0 commit comments

Comments
 (0)