Skip to content

Commit 64b1cb0

Browse files
ykshah1309olaservo
andauthored
feat(memory): add tool annotations to all knowledge graph tools (#3874)
Add MCP ToolAnnotations to all 9 tools in the memory server, matching the annotation coverage already present in server-filesystem, server-git, server-time, and server-sequential-thinking. - Read tools (read_graph, search_nodes, open_nodes): read-only, idempotent - Write tools (create_entities, create_relations, add_observations): non-destructive - Delete tools (delete_entities, delete_observations, delete_relations): destructive, idempotent - All tools: openWorldHint=false (local JSONL file operations only) Co-authored-by: Ola Hungerford <olahungerford@gmail.com>
1 parent 9bade64 commit 64b1cb0

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

src/memory/index.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,12 @@ server.registerTool(
269269
},
270270
outputSchema: {
271271
entities: z.array(EntitySchema)
272+
},
273+
annotations: {
274+
readOnlyHint: false,
275+
destructiveHint: false,
276+
idempotentHint: false,
277+
openWorldHint: false,
272278
}
273279
},
274280
async ({ entities }) => {
@@ -291,6 +297,12 @@ server.registerTool(
291297
},
292298
outputSchema: {
293299
relations: z.array(RelationSchema)
300+
},
301+
annotations: {
302+
readOnlyHint: false,
303+
destructiveHint: false,
304+
idempotentHint: false,
305+
openWorldHint: false,
294306
}
295307
},
296308
async ({ relations }) => {
@@ -319,6 +331,12 @@ server.registerTool(
319331
entityName: z.string(),
320332
addedObservations: z.array(z.string())
321333
}))
334+
},
335+
annotations: {
336+
readOnlyHint: false,
337+
destructiveHint: false,
338+
idempotentHint: false,
339+
openWorldHint: false,
322340
}
323341
},
324342
async ({ observations }) => {
@@ -342,6 +360,12 @@ server.registerTool(
342360
outputSchema: {
343361
success: z.boolean(),
344362
message: z.string()
363+
},
364+
annotations: {
365+
readOnlyHint: false,
366+
destructiveHint: true,
367+
idempotentHint: true,
368+
openWorldHint: false,
345369
}
346370
},
347371
async ({ entityNames }) => {
@@ -368,6 +392,12 @@ server.registerTool(
368392
outputSchema: {
369393
success: z.boolean(),
370394
message: z.string()
395+
},
396+
annotations: {
397+
readOnlyHint: false,
398+
destructiveHint: true,
399+
idempotentHint: true,
400+
openWorldHint: false,
371401
}
372402
},
373403
async ({ deletions }) => {
@@ -391,6 +421,12 @@ server.registerTool(
391421
outputSchema: {
392422
success: z.boolean(),
393423
message: z.string()
424+
},
425+
annotations: {
426+
readOnlyHint: false,
427+
destructiveHint: true,
428+
idempotentHint: true,
429+
openWorldHint: false,
394430
}
395431
},
396432
async ({ relations }) => {
@@ -412,6 +448,12 @@ server.registerTool(
412448
outputSchema: {
413449
entities: z.array(EntitySchema),
414450
relations: z.array(RelationSchema)
451+
},
452+
annotations: {
453+
readOnlyHint: true,
454+
destructiveHint: false,
455+
idempotentHint: true,
456+
openWorldHint: false,
415457
}
416458
},
417459
async () => {
@@ -435,6 +477,12 @@ server.registerTool(
435477
outputSchema: {
436478
entities: z.array(EntitySchema),
437479
relations: z.array(RelationSchema)
480+
},
481+
annotations: {
482+
readOnlyHint: true,
483+
destructiveHint: false,
484+
idempotentHint: true,
485+
openWorldHint: false,
438486
}
439487
},
440488
async ({ query }) => {
@@ -458,6 +506,12 @@ server.registerTool(
458506
outputSchema: {
459507
entities: z.array(EntitySchema),
460508
relations: z.array(RelationSchema)
509+
},
510+
annotations: {
511+
readOnlyHint: true,
512+
destructiveHint: false,
513+
idempotentHint: true,
514+
openWorldHint: false,
461515
}
462516
},
463517
async ({ names }) => {

0 commit comments

Comments
 (0)