Skip to main content
Glama

get_relation_history

Retrieve the version history of a specific relation between two entities in a knowledge graph, enabling temporal analysis and tracking changes over time.

Instructions

Get the version history of a relation from your Memento MCP knowledge graph memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesThe name of the entity where the relation starts
relationTypeYesThe type of the relation
toYesThe name of the entity where the relation ends

Implementation Reference

  • The core handler logic for the 'get_relation_history' tool. It extracts 'from', 'to', and 'relationType' from input args, calls KnowledgeGraphManager.getRelationHistory, and returns the JSON-stringified history or an error message.
    case 'get_relation_history': try { const history = await knowledgeGraphManager.getRelationHistory( args.from, args.to, args.relationType ); return { content: [{ type: 'text', text: JSON.stringify(history, null, 2) }] }; } catch (error: Error | unknown) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: `Error retrieving relation history: ${errorMessage}` }], }; }
  • Tool registration in listToolsHandler, defining the name, description, and input schema (JSON Schema) for 'get_relation_history'.
    name: 'get_relation_history', description: 'Get the version history of a relation from your Memento MCP knowledge graph memory', inputSchema: { type: 'object', properties: { from: { type: 'string', description: 'The name of the entity where the relation starts', }, to: { type: 'string', description: 'The name of the entity where the relation ends', }, relationType: { type: 'string', description: 'The type of the relation', }, }, required: ['from', 'to', 'relationType'], }, },
  • Supporting method in KnowledgeGraphManager that checks for and delegates to storageProvider.getRelationHistory.
    async getRelationHistory(from: string, to: string, relationType: string): Promise<Relation[]> { if (!this.storageProvider || typeof this.storageProvider.getRelationHistory !== 'function') { throw new Error('Storage provider does not support relation history operations'); } return this.storageProvider.getRelationHistory(from, to, relationType); }
  • TypeScript interface definition in StorageProvider for the getRelationHistory method signature.
    getRelationHistory?(from: string, to: string, relationType: string): Promise<any[]>;

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/gannonh/memento-mcp'

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