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 }; }

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