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;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states 'read' which implies a non-destructive operation, but doesn't disclose behavioral traits such as permissions needed, rate limits, what 'entire' entails (e.g., all nodes/relations), or the return format. This is inadequate for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action and resource, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a knowledge graph tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'read' returns (e.g., nodes, relations, structure) or how 'entire' is defined, leaving significant gaps for an agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter details in the description. The baseline for 0 parameters is 4, as the description doesn't need to compensate for any gaps, and it appropriately doesn't mention parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Read the entire knowledge graph' clearly states the action (read) and resource (knowledge graph), but it's vague about what 'entire' means and doesn't differentiate from sibling tools like 'search_nodes' or 'open_nodes'. It's not tautological but lacks specificity about scope or format.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'search_nodes' or 'open_nodes'. The description implies a broad read operation but doesn't specify prerequisites, exclusions, or comparative use cases with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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