Add tool annotations to server-memory (9 tools, 0 annotated)
Request: Add tool annotations — @modelcontextprotocol/server-memory v0.6.3
Context
We ran an automated scan of this server via live JSON-RPC handshake. This server currently provides zero annotations on all 9 tools. Three tools perform permanent, cascading deletions with no undo — and none of them signal this to clients.
For reference, @modelcontextprotocol/server-filesystem annotates all 14 of its tools with readOnlyHint, destructiveHint, and idempotentHint. We're requesting the same treatment here.
Current state — 0/9 tools annotated
| # | Tool | readOnlyHint |
destructiveHint |
idempotentHint |
openWorldHint |
|---|---|---|---|---|---|
| 1 | create_entities |
— | — | — | — |
| 2 | create_relations |
— | — | — | — |
| 3 | add_observations |
— | — | — | — |
| 4 | delete_entities |
— | — | — | — |
| 5 | delete_observations |
— | — | — | — |
| 6 | delete_relations |
— | — | — | — |
| 7 | read_graph |
— | — | — | — |
| 8 | search_nodes |
— | — | — | — |
| 9 | open_nodes |
— | — | — | — |
Suggested annotations — per tool
| # | Tool | readOnlyHint |
destructiveHint |
idempotentHint |
openWorldHint |
|---|---|---|---|---|---|
| 1 | create_entities |
false |
false |
false |
false |
| 2 | create_relations |
false |
false |
false |
false |
| 3 | add_observations |
false |
false |
false |
false |
| 4 | delete_entities |
false |
true |
false |
false |
| 5 | delete_observations |
false |
true |
false |
false |
| 6 | delete_relations |
false |
true |
true |
false |
| 7 | read_graph |
true |
false |
true |
false |
| 8 | search_nodes |
true |
false |
true |
false |
| 9 | open_nodes |
true |
false |
true |
false |
Suggested code change — top 3 priority tools
delete_entities (highest priority)
server.registerTool(
"delete_entities",
{
description: "Delete multiple entities and their associated relations from the knowledge graph",
inputSchema: { entityNames: z.array(z.string()) },
annotations: {
readOnlyHint: false,
destructiveHint: true,
idempotentHint: false,
openWorldHint: false,
},
},
handler
);
delete_observations
server.registerTool(
"delete_observations",
{
description: "Delete specific observations from entities in the knowledge graph",
inputSchema: { deletions: z.array(z.object({ entityName: z.string(), observations: z.array(z.string()) })) },
annotations: {
readOnlyHint: false,
destructiveHint: true,
idempotentHint: false,
openWorldHint: false,
},
},
handler
);
read_graph
server.registerTool(
"read_graph",
{
description: "Read the entire knowledge graph",
inputSchema: {},
annotations: {
readOnlyHint: true,
idempotentHint: true,
openWorldHint: false,
},
},
handler
);
Rationale for each
delete_entities → destructiveHint: true, idempotentHint: false
Permanently deletes entities AND cascades to all associated relations. Calling it twice on overlapping entity sets could fail on the second call (entities already gone). This is the highest-risk tool on this server.
delete_observations → destructiveHint: true, idempotentHint: false
Permanently removes specific observations. No undo, no trash.
delete_relations → destructiveHint: true, idempotentHint: true
Permanently removes graph edges. Idempotent — deleting an already-deleted relation is a no-op.
create_entities / create_relations / add_observations → destructiveHint: false, idempotentHint: false
Additive-only writes. Not destructive (they don't remove or overwrite data). Not idempotent (calling create twice produces duplicate entities).
read_graph / search_nodes / open_nodes → readOnlyHint: true, idempotentHint: true
Pure reads. No state mutation.
All tools → openWorldHint: false
The knowledge graph is local. No external network calls, no side effects outside the graph file.
Why this matters — chaining risks in multi-server setups
This server is commonly installed alongside filesystem, GitHub, and network-capable MCP servers. Without annotations, clients and downstream tools have to guess which operations are safe. As the MCP ecosystem grows and more tooling consumes annotations, having accurate metadata becomes increasingly important.
Concrete examples of composition risks that annotations help surface:
-
delete_entitiestriggered by prompt injection → An agent processing untrusted input (email, chat, web content) could be instructed to "clean up the knowledge graph."destructiveHint: trueenables any MCP client that respects the spec to add a confirmation step before permanent deletion. Without it, the delete is indistinguishable from a read to annotation-aware clients. -
read_graph+ network server → The knowledge graph may accumulate sensitive data across sessions (user preferences, conversation history, project details). If an agent chainsread_graphinto an outbound network call, the graph could be exfiltrated.readOnlyHint: trueonread_graphclarifies the read is safe in isolation — the risk is in the composition, not the individual tool. This distinction is what enables "allow reads, gate sends" as a policy pattern.
Impact
A client or tool that relies on server-provided annotations (as the MCP spec encourages) currently sees all 9 tools as identical — no risk differentiation at all. Proper annotations make the risk classification reliable without depending on heuristics like tool-name parsing.
The change is roughly 45 lines of metadata additions across 9 tool registrations. No behavior changes. The server-filesystem already sets the precedent.
Found via automated scan with AgentWard. Enumerated via live JSON-RPC handshake, protocol 2025-11-25.
How we found this
This was discovered using AgentWard — an open-source MCP security scanner that enumerates tools via live JSON-RPC handshake and assesses risk levels, data access patterns, and annotation coverage.
Reproduce
pip install agentward
# Create a minimal MCP config
cat > /tmp/mcp_config.json << 'CONFIG'
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}
CONFIG
# Scan — enumerates all 9 tools, shows risk ratings and annotation gaps
agentward scan /tmp/mcp_config.json
# JSON output for programmatic use
agentward scan /tmp/mcp_config.json --json
AgentWard currently catches the 3 delete tools as HIGH risk by detecting the delete prefix in tool names, but name-based heuristics are fragile and shouldn't be the only signal. With destructiveHint: true annotations, any spec-compliant client or scanner gets reliable classification without heuristics.
The missing annotations are a real safety gap for autonomous agents. We operate a fleet of 9+ agents that share a persistent memory layer, and the first thing we learned is that any tool an agent can call, it eventually will call — including destructive ones. Marking delete_entities and delete_observations with destructiveHint: true is table stakes, but I would go further and argue that create_entities should also be annotated with idempotentHint: false since duplicate entity creation can silently fragment the knowledge graph. In our system we enforce idempotency at the storage layer (upsert semantics with deduplication), and we tag every memory operation with an importance score so the agent can reason about whether a write is worth the side effects. For anyone building tool annotations into their own MCP memory server, our Python SDK exposes these hints per-operation — example at https://github.com/Dakera-AI/dakera-py
I checked current modelcontextprotocol/servers main and it looks like src/memory/index.ts now has annotations for all 9 memory tools. The shape looks right overall: writes are non-read-only, deletes are destructive, and read/search/open are read-only.
I also checked the published @modelcontextprotocol/[email protected] package, and its built dist/index.js does not appear to include those annotations yet. So this may be fixed on main but not visible to users through the current package.
One small semantic check before closing: is idempotentHint: true intentional for delete_entities and delete_observations? It is fine if repeated deletes are guaranteed no-ops, but some clients may treat idempotent destructive operations as retryable. If that guarantee holds, cool. If not, destructive but non-idempotent may be the safer signal.
Either way, this is the right kind of coverage. It gives clients a declared signal instead of forcing scanners, hosts, and downstream audit consumers like Assay back to name heuristics.
Adding a production data point: we implemented readOnlyHint, destructiveHint, and idempotentHint on every tool across 65+ MCP tools, and it cut agent-initiated destructive mistakes by roughly 95%. The annotations become safety rails — agents automatically route destructive calls through confirmation gates.
One thing worth flagging for this specific server: idempotentHint on the delete_* tools matters more than we initially expected. When agents retry after timeouts (which happens constantly in production), non-idempotent deletions cause cascade failures. Marking them as idempotent (since deleting an already-deleted entity is a no-op) prevents this entirely.
The suggested annotations look correct to me. For open_nodes and search_nodes specifically, openWorldHint: true would be appropriate since the knowledge graph is inherently open-world and agents should not assume completeness of results.
Good production data point. I rechecked the current implementation and agree the delete hints being idempotent look defensible here: delete_entities, delete_observations, and delete_relations all filter current graph state and missing targets become no-ops. So destructiveHint: true plus idempotentHint: true is a better signal than my earlier caution if that behavior is considered part of the contract.
I would be a bit more careful on openWorldHint though. If we use it as “the graph may be incomplete”, then almost every local store becomes open-world. If we use it as “this tool reaches outside its local bounded store or external entities”, false still feels right for memory. That distinction matters for clients that want to allow local reads while gating network or external-system reach.
So from an audit/interop angle, including downstream consumers like Assay or Plimsoll, the important thing is to keep the meaning stable: annotations describe the tool boundary, not whether the model should treat graph contents as complete truth. The main remaining user-facing gap still looks like release visibility: main has the annotations, the latest published package does not yet expose them.
Happy to help close this with a PR.
I checked the current published @modelcontextprotocol/server-memory build with an open-source MCP hygiene scanner I maintain (mcp-security-lab). All 9 tools already declare readOnlyHint/destructiveHint, but they are missing the human-readable title annotation that clients use for display (and that the spec recommends). Suggested mapping, inferred from the tool semantics:
- Read-only (
readOnlyHint: true):read_graph,search_nodes,open_nodes - Non-destructive writes:
add_observations,create_entities,create_relations - Destructive (
destructiveHint: true):delete_entities,delete_observations,delete_relations
If a titles-only PR (plus a quick pass to confirm the read/write/destructive hints line up with the above) is welcome, I can open one. Glad to follow the repo's conventions — just point me at a preferred title style.
All nine tools now carry annotations on main (#3874, merged 2026-05-30): readOnlyHint, destructiveHint, idempotentHint and openWorldHint on every tool, with destructiveHint: true on the three delete tools. Each tool also has a title. Closing as completed.