Skip to main content
Glama

read_graph

Retrieve the complete knowledge graph structure to access indexed codebase relationships and semantic connections for analysis.

Instructions

Read the entire knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the core logic of the 'read_graph' tool. It invokes knowledgeGraphManager.readGraph() and formats the entire knowledge graph as a JSON string in the MCP content format.
    export const readGraphHandler = async (args) => {
        try {
            const graph = await knowledgeGraphManager.readGraph();
            return {
                content: [{
                        type: "text",
                        text: JSON.stringify(graph, null, 2)
                    }]
            };
        }
        catch (error) {
            console.error("Error in read_graph tool:", error);
            throw error;
        }
    };
  • The tool definition object containing the name, description, and input schema (empty object since no parameters are required). This is used during registration.
    export const readGraphTool = {
        name: "read_graph",
        description: "Read the entire knowledge graph",
        inputSchema: {
            type: "object",
            properties: {},
            required: [],
        },
    };
  • The code block in the auto-registration logic that discovers and registers the tool by calling toolRegistry.register(tool, handler) for discovered Tool/Handler exports, including 'read_graph' from read-graph.js.
    for (const { tool, handler } of tools) {
        if (this.registeredTools.has(tool.name)) {
            if (this.config.verbose) {
                console.log(`⏭️ Outil déjà enregistré: ${tool.name}`);
            }
            continue;
        }
        try {
            toolRegistry.register(tool, handler);
            this.registeredTools.add(tool.name);
            registeredCount++;
            if (this.config.verbose) {
                console.log(`✅ Outil enregistré automatiquement: ${tool.name} (${path})`);
            }
        }
  • The underlying helper method in KnowledgeGraphManager that loads and returns the entire knowledge graph from the memory file.
    async readGraph() {
        return this.loadGraph();
    }
  • 'read_graph' is listed in the expected tools array used for verification after auto-registration.
    'delete_relations',
    'read_graph',
    'search_nodes',
    'open_nodes',
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 of behavioral disclosure. It states 'read' implies a safe operation, but doesn't clarify performance aspects (e.g., is this a heavy operation that might time out?), data format (structured graph? raw text?), or side effects (does it cache data?). For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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, clear sentence with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word contributes to understanding the tool's function.

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 insufficient. It doesn't explain what 'read' returns (e.g., nodes, edges, metadata) or handle potential issues like large graph sizes. For a tool that likely interacts with structured data, more context on output and behavior is needed to be complete.

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 input schema has 0 parameters with 100% coverage, meaning no parameters are documented in the schema. The description doesn't mention any parameters, which is appropriate since none exist. It implies the tool reads the graph without inputs, adding value by clarifying the scope ('entire'), though it could specify if filters or options are implicitly applied.

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), making the purpose understandable. However, it lacks specificity about what 'entire' means (all nodes/relations? all data without filtering?) and doesn't distinguish this from sibling tools like 'search_nodes' or 'open_nodes', which might also read graph data with different scopes.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'search_nodes' (likely for filtered queries) and 'open_nodes' (possibly for specific nodes), there's no indication that this tool is for bulk retrieval versus targeted access. No prerequisites, exclusions, or comparative context are mentioned.

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/ali-48/rag-mcp-server'

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