Skip to main content
Glama

get_relation_history

Retrieve version history for relationships between entities in a knowledge graph, tracking changes over time to understand connection evolution.

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
toYesThe name of the entity where the relation ends
relationTypeYesThe type of the relation

Implementation Reference

  • Handler logic in the main callToolHandler switch statement that extracts parameters (from, to, relationType) from the tool arguments, calls knowledgeGraphManager.getRelationHistory, and returns the JSON-formatted history or 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 the temporalTools array, including name, description, and inputSchema defining the required parameters (from, to, relationType). This makes the tool available via listTools.
    { 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'], }, },
  • Input schema definition for the get_relation_history tool, specifying object with properties from, to, relationType (all strings, required).
    { 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'], }, },
  • Core helper method in KnowledgeGraphManager that checks for storageProvider support and delegates the getRelationHistory call to it, throwing an error if not supported.
    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); }
  • Interface definition for the optional getRelationHistory method in StorageProvider, specifying parameters and return type (Promise<any[]>).
    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