Skip to main content
Glama
itseasy21

Knowledge Graph Memory Server

read_graph

Retrieve the complete knowledge graph to access stored user information and conversation history for persistent memory across sessions.

Instructions

Read the entire knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that executes the logic for the 'read_graph' tool by loading the knowledge graph from the memory file.
    async readGraph(): Promise<KnowledgeGraph> { return this.loadGraph(); }
  • index.ts:420-427 (registration)
    Registration of the 'read_graph' tool in the MCP server's tool list, including name, description, and input schema (no parameters required).
    { name: "read_graph", description: "Read the entire knowledge graph", inputSchema: { type: "object", properties: {}, }, },
  • MCP CallToolRequest handler case that invokes the readGraph method and returns the result as formatted JSON text content.
    case "read_graph": return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.readGraph(), null, 2) }] };
  • Input schema for the 'read_graph' tool, defining an empty object (no input parameters).
    inputSchema: { type: "object", properties: {}, },
  • Helper method loadGraph() called by readGraph(), responsible for parsing the JSONL memory file into the KnowledgeGraph structure.
    private async loadGraph(): Promise<KnowledgeGraph> { try { const data = await fs.readFile(MEMORY_FILE_PATH, "utf-8"); const lines = data.split("\n").filter(line => line.trim() !== ""); return lines.reduce((graph: KnowledgeGraph, line) => { const item = JSON.parse(line); if (item.type === "entity") graph.entities.push(item as Entity); if (item.type === "relation") graph.relations.push(item as Relation); return graph; }, { entities: [], relations: [] }); } catch (error) { if (error instanceof Error && 'code' in error && (error as any).code === "ENOENT") { return { entities: [], relations: [] }; } throw error; } }

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/itseasy21/mcp-knowledge-graph'

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