open_nodes
Retrieve specific entities from a knowledge graph by providing their names. Enhances structured thinking and problem-solving within AI workflows.
Instructions
Open specific nodes in the knowledge graph by their names
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| names | Yes | Array of entity names to retrieve |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"names": {
"description": "Array of entity names to retrieve",
"items": {
"minLength": 1,
"type": "string"
},
"type": "array"
}
},
"required": [
"names"
],
"type": "object"
}
Implementation Reference
- src/memory/tools.ts:449-461 (handler)The execute function for the 'open_nodes' tool. It retrieves entities from the knowledge graph using graph.getEntities(args.names), computes found and notFound lists, and returns a JSON string with entities, found names, notFound names, and a summary message.execute: async (args) => { const results = graph.getEntities(args.names); const found = results.map(entity => entity.name); const notFound = args.names.filter(name => !found.includes(name)); // Return as string return JSON.stringify({ entities: results, found, notFound: notFound.length > 0 ? notFound : null, message: `Found ${found.length} entities. ${notFound.length} entities not found.` }); }
- src/memory/tools.ts:445-462 (registration)The server.addTool call that registers the 'open_nodes' tool within the registerMemoryTools function, including name, description, parameters schema, and inline execute handler.server.addTool({ name: 'open_nodes', description: 'Open specific nodes in the knowledge graph by their names', parameters: Schemas.OpenNodesSchema, execute: async (args) => { const results = graph.getEntities(args.names); const found = results.map(entity => entity.name); const notFound = args.names.filter(name => !found.includes(name)); // Return as string return JSON.stringify({ entities: results, found, notFound: notFound.length > 0 ? notFound : null, message: `Found ${found.length} entities. ${notFound.length} entities not found.` }); } });
- src/utils/validation.ts:66-68 (schema)Zod schema for 'open_nodes' tool input parameters: an array of strings representing entity names to retrieve from the knowledge graph.export const OpenNodesSchema = z.object({ names: z.array(z.string().min(1)).describe('Array of entity names to retrieve') });