Skip to main content
Glama
StevenWangler

MCP Memory Server

read_graph

Retrieve the complete knowledge graph from the MCP Memory Server to enable LLMs to access and reason over stored information across sessions and conversations.

Instructions

Read the entire knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool dispatch handler for 'read_graph' that calls the readGraph method and returns formatted JSON response.
    case "read_graph":
      return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.readGraph(), null, 2) }] };
  • Handler function in KnowledgeGraphManager that executes the core logic for reading the entire knowledge graph by delegating to loadGraph.
    async readGraph(): Promise<KnowledgeGraph> {
      return this.loadGraph();
    }
  • Type definition/schema for the KnowledgeGraph object returned by the read_graph tool.
    interface KnowledgeGraph {
      entities: Entity[];
      relations: Relation[];
    }
  • src/index.ts:338-346 (registration)
    Registration of the read_graph tool in the ListTools response, including name, description, and empty input schema.
    {
      name: "read_graph",
      description: "Read the entire knowledge graph",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
    {
  • Private helper method that loads the knowledge graph from the memory JSON lines file, handling file not found gracefully.
    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?

With no annotations provided, the description carries full burden but only states the action ('Read') without disclosing behavioral traits like permissions needed, rate limits, pagination, or what 'entire' entails (e.g., size limits, performance impact). It's minimal and leaves critical operational details unspecified.

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 and appropriately sized for a simple tool, making it easy to parse quickly.

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 no annotations and no output schema, the description is incomplete for a tool that presumably returns complex graph data. It lacks context on output format, size, or structure, which is essential for an agent to use it effectively, especially compared to siblings with more specific functions.

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 with 100% schema description coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate, earning a baseline score of 4 for adequately handling the parameter-free case.

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' states a clear verb ('Read') and resource ('knowledge graph'), but lacks specificity about what 'entire' means and doesn't differentiate from sibling tools like 'search_nodes' or 'open_nodes'. It's vague about scope and boundaries.

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 use cases, prerequisites, or exclusions compared to siblings.

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

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/StevenWangler/mcp-memory-server'

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