Skip to content

feat(memory): add tool annotations to all 9 tools#3655

Open
owendevereaux wants to merge 1 commit intomodelcontextprotocol:mainfrom
owendevereaux:fix/memory-tool-annotations
Open

feat(memory): add tool annotations to all 9 tools#3655
owendevereaux wants to merge 1 commit intomodelcontextprotocol:mainfrom
owendevereaux:fix/memory-tool-annotations

Conversation

@owendevereaux
Copy link

Summary

Add tool annotations to all 9 tools in the memory server, following the patterns established in server-filesystem.

Changes

Read-only tools (readOnlyHint: true, idempotentHint: true)

  • read_graph - reads entire knowledge graph
  • search_nodes - searches for nodes by query
  • open_nodes - retrieves specific nodes by name

Write tools (readOnlyHint: false, destructiveHint: false)

  • create_entities - creates new entities (not idempotent - duplicates possible)
  • create_relations - creates new relations (not idempotent)
  • add_observations - adds observations to entities (not idempotent)

Destructive tools (destructiveHint: true)

  • delete_entities - permanently deletes entities AND cascades to relations (idempotentHint: false)
  • delete_observations - permanently removes observations (idempotentHint: false)
  • delete_relations - removes graph edges (idempotentHint: true - deleting already-deleted is no-op)

All tools have openWorldHint: false as the knowledge graph is local with no external network calls.

Rationale

As noted in #3400, without annotations, clients have no way to differentiate risk levels between tools. The delete tools in particular perform permanent, cascading deletions with no undo - destructiveHint: true enables annotation-aware clients to add confirmation steps.

This is a metadata-only change (~54 lines). No behavior changes.

Fixes #3400

Add readOnlyHint, destructiveHint, idempotentHint, and openWorldHint
annotations to all tools in the memory server:

Read-only tools (readOnlyHint: true, idempotentHint: true):
- read_graph
- search_nodes
- open_nodes

Write tools (readOnlyHint: false):
- create_entities (not destructive, not idempotent)
- create_relations (not destructive, not idempotent)
- add_observations (not destructive, not idempotent)

Destructive tools (destructiveHint: true):
- delete_entities (not idempotent - cascade deletes relations)
- delete_observations (not idempotent)
- delete_relations (idempotent - deleting already-deleted is no-op)

All tools have openWorldHint: false as the knowledge graph is local.

Fixes modelcontextprotocol#3400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tool annotations to server-memory (9 tools, 0 annotated)

1 participant