Skip to main content
Glama
YuNaga224
by YuNaga224

search_nodes

Find entities, relations, and observations in your Obsidian knowledge graph using search queries to match names, types, and content.

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 knowledge graph, performs case-insensitive search on entity names, types, and observations, filters matching entities and their inter-relations.
    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 }; }
  • index.ts:173-183 (registration)
    Registers the 'search_nodes' tool with the MCP server, including name, description, and input schema requiring a 'query' parameter.
    { 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"], }, },
  • Top-level MCP CallTool handler case that delegates to storageManager.searchNodes and formats the response as JSON text content.
    case "search_nodes": return { content: [{ type: "text", text: JSON.stringify(await storageManager.searchNodes(args.query as string), null, 2) }] };

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