Skip to content

Commit 942d8f1

Browse files
cliffhallclaude
andcommitted
feat(memory): say when to use search_nodes and open_nodes
Each description now says what the tool is for and which sibling read tool to prefer instead: open_nodes for names already known, search_nodes for a keyword or partial name, read_graph only for the whole graph. read_graph's own description is changed by #3953's PR, which rewrites the inputSchema on the line next to it. Closes #5202 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 446be48 commit 942d8f1

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-memory": patch
3+
---
4+
5+
The `search_nodes` and `open_nodes` tool descriptions now say when to use each one and which sibling read tool to prefer instead, so a model looks an entity up by name with `open_nodes`, searches by keyword with `search_nodes`, and leaves `read_graph` for when it needs the whole graph.

‎src/memory/__tests__/tools.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ const expectedTools = [
283283
{
284284
name: "search_nodes",
285285
title: "Search Nodes",
286-
description: "Search for nodes in the knowledge graph based on a query",
286+
description:
287+
"Search the knowledge graph for entities whose name, type or observations contain the query (case-insensitive). Use this when you have a keyword, a topic or part of a name but not the exact entity names. Prefer open_nodes when you already know the exact names, and use read_graph only when you need the whole graph. Returns the matching entities and every relation that touches one of them.",
287288
inputSchema: {
288289
type: "object",
289290
properties: {
@@ -304,7 +305,8 @@ const expectedTools = [
304305
{
305306
name: "open_nodes",
306307
title: "Open Nodes",
307-
description: "Open specific nodes in the knowledge graph by their names",
308+
description:
309+
"Retrieve specific entities by their exact names, with every relation that touches one of them. Use this when you already know the names (from the conversation, or from an earlier search_nodes or read_graph result); it is the cheapest way to read entities you can name. Prefer search_nodes when you only have a keyword or part of a name. Names that do not exist are skipped.",
308310
inputSchema: {
309311
type: "object",
310312
properties: {

‎src/memory/index.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,8 @@ export function createServer(
11211121
"search_nodes",
11221122
{
11231123
title: "Search Nodes",
1124-
description: "Search for nodes in the knowledge graph based on a query",
1124+
description:
1125+
"Search the knowledge graph for entities whose name, type or observations contain the query (case-insensitive). Use this when you have a keyword, a topic or part of a name but not the exact entity names. Prefer open_nodes when you already know the exact names, and use read_graph only when you need the whole graph. Returns the matching entities and every relation that touches one of them.",
11251126
inputSchema: z.object({
11261127
query: SearchNodesQuerySchema,
11271128
}),
@@ -1152,7 +1153,8 @@ export function createServer(
11521153
"open_nodes",
11531154
{
11541155
title: "Open Nodes",
1155-
description: "Open specific nodes in the knowledge graph by their names",
1156+
description:
1157+
"Retrieve specific entities by their exact names, with every relation that touches one of them. Use this when you already know the names (from the conversation, or from an earlier search_nodes or read_graph result); it is the cheapest way to read entities you can name. Prefer search_nodes when you only have a keyword or part of a name. Names that do not exist are skipped.",
11561158
inputSchema: z.object({
11571159
names: z
11581160
.array(z.string())

0 commit comments

Comments
 (0)