Skip to main content
Glama
YuNaga224
by YuNaga224

search_nodes

Search for entities, types, and observation content in a knowledge graph stored in Obsidian Memory MCP. Use a query to retrieve relevant nodes for enhanced knowledge graph navigation and analysis.

Instructions

Search for nodes in the knowledge graph based on a query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query to match against entity names, types, and observation content

Implementation Reference

  • Core implementation of the search_nodes tool logic: loads the full graph, filters entities matching the query in name, entityType, or observations (case-insensitive), then filters relations to only those connecting matching entities, returning a KnowledgeGraph subset.
    async searchNodes(query: string): Promise<KnowledgeGraph> { const graph = await this.loadGraph(); const queryLower = query.toLowerCase(); // Filter entities const filteredEntities = graph.entities.filter(e => e.name.toLowerCase().includes(queryLower) || e.entityType.toLowerCase().includes(queryLower) || e.observations.some(o => o.toLowerCase().includes(queryLower)) ); // Get filtered entity names const filteredEntityNames = new Set(filteredEntities.map(e => e.name)); // Filter relations to only include those between filtered entities const filteredRelations = graph.relations.filter(r => filteredEntityNames.has(r.from) && filteredEntityNames.has(r.to) ); return { entities: filteredEntities, relations: filteredRelations }; }
  • MCP tool dispatch handler for search_nodes: extracts query from args, calls storageManager.searchNodes, stringifies the KnowledgeGraph result as JSON, and returns it in the expected MCP content format.
    case "search_nodes": return { content: [{ type: "text", text: JSON.stringify(await storageManager.searchNodes(args.query as string), null, 2) }] };
  • index.ts:173-183 (registration)
    Tool registration in ListToolsRequestSchema handler: defines name 'search_nodes', description, and inputSchema requiring a 'query' string.
    { name: "search_nodes", description: "Search for nodes in the knowledge graph based on a query", inputSchema: { type: "object", properties: { query: { type: "string", description: "The search query to match against entity names, types, and observation content" }, }, required: ["query"], }, },
  • Input schema for search_nodes tool: object with required 'query' string property.
    inputSchema: { type: "object", properties: { query: { type: "string", description: "The search query to match against entity names, types, and observation content" }, }, required: ["query"], },

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/YuNaga224/obsidian-memory-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server