Skip to main content
Glama

read_graph

Extract recent entities and their relationships from a high-performance MCP server using libSQL for memory persistence and vector search. Enhance entity management and semantic knowledge retrieval.

Instructions

Get recent entities and their relations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'read_graph' MCP tool. It calls the database's read_graph method, serializes the result to JSON text content, and handles errors by returning an error response.
    async () => {
    	try {
    		const result = await db.read_graph();
    		return {
    			content: [
    				{
    					type: 'text' as const,
    					text: JSON.stringify(result, null, 2),
    				},
    			],
    		};
    	} catch (error) {
    		return {
    			content: [
    				{
    					type: 'text' as const,
    					text: JSON.stringify(
    						{
    							error: 'internal_error',
    							message:
    								error instanceof Error
    									? error.message
    									: 'Unknown error',
    						},
    						null,
    						2,
    					),
    				},
    			],
    			isError: true,
    		};
    	}
    },
  • src/index.ts:145-149 (registration)
    Registration of the 'read_graph' tool with the MCP server via server.tool(). Specifies the tool name and description. No input schema is provided as the tool takes no parameters.
    server.tool(
    	{
    		name: 'read_graph',
    		description: 'Get recent entities and their relations',
    	},
  • Helper method in DatabaseManager class that fetches recent entities using get_recent_entities() and their relations using get_relations_for_entities(), returning the graph data structure.
    async read_graph(): Promise<{
    	entities: Entity[];
    	relations: Relation[];
    }> {
    	const recent_entities = await this.get_recent_entities();
    	const relations = await this.get_relations_for_entities(
    		recent_entities,
    	);
    	return { entities: recent_entities, relations };
    }
Behavior2/5

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

With no annotations, the description carries the full burden but only states what the tool does, not behavioral traits like permissions needed, rate limits, or what 'recent' means (e.g., time frame). It doesn't disclose critical operational details for a read operation.

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.

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, no output schema, and a simple tool with 0 parameters, the description is incomplete. It lacks details on what 'recent' entails, the format of returned data, or any behavioral constraints, making it insufficient for reliable use.

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?

There are 0 parameters, and schema description coverage is 100%, so no parameter information is needed. The description adds context about retrieving 'recent' entities and relations, which is meaningful beyond the empty schema.

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

Purpose4/5

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

The description clearly states the verb 'Get' and the resources 'recent entities and their relations', making the purpose understandable. It doesn't explicitly distinguish from siblings like 'search_nodes', but it's not vague or tautological.

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 'create_entities'. The description implies usage for retrieving recent data but doesn't specify contexts, exclusions, or prerequisites.

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/spences10/mcp-memory-libsql'

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