Skip to content

Commit 4bb9ddc

Browse files
committed
add tests
1 parent 7041142 commit 4bb9ddc

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/tools/tool.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,17 @@ export abstract class ToolBase {
8181
this.update = (updates: { name?: string; description?: string; inputSchema?: AnyZodObject }) => {
8282
const tools = server["_registeredTools"] as { [toolName: string]: RegisteredTool };
8383
const existingTool = tools[this.name];
84+
existingTool.annotations = this.annotations;
8485

8586
if (updates.name && updates.name !== this.name) {
87+
existingTool.annotations.title = updates.name;
8688
delete tools[this.name];
8789
this.name = updates.name;
8890
tools[this.name] = existingTool;
8991
}
9092

9193
if (updates.description) {
94+
existingTool.annotations.description = updates.description;
9295
existingTool.description = updates.description;
9396
this.description = updates.description;
9497
}

tests/integration/helpers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ export function validateToolMetadata(
206206
expectDefined(tool);
207207
expect(tool.description).toBe(description);
208208

209+
expectDefined(tool.annotations);
210+
// expect(tool.annotations.title).toBe(name);
211+
expect(tool.annotations.description).toBe(description);
209212
const toolParameters = getParameters(tool);
210213
expect(toolParameters).toHaveLength(parameters.length);
211214
expect(toolParameters).toIncludeAllMembers(parameters);

0 commit comments

Comments
 (0)