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
| Name | Required | Description | Default |
|---|---|---|---|
| from | Yes | The name of the entity where the relation starts | |
| relationType | Yes | The type of the relation | |
| to | Yes | The 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}` }], }; }
- src/server/handlers/listToolsHandler.ts:424-445 (registration)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[]>;