create_memory_relationship
Establish and define relationships between memories in the AGI MCP Server by specifying source, target, and relationship type (causal, temporal, semantic, emotional, strategic, or consolidation).
Instructions
Create a relationship between two memories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_memory_id | Yes | UUID of the source memory | |
| properties | No | Additional properties for the relationship | |
| relationship_type | Yes | Type of relationship | |
| to_memory_id | Yes | UUID of the target memory |
Implementation Reference
- src/memory-manager.js:609-626 (handler)Core handler function that executes the tool logic: inserts a new relationship record into the memoryRelationships database table using Drizzle ORM and returns the created relationship.async createMemoryRelationship(fromMemoryId, toMemoryId, relationshipType, properties = {}) { try { const [relationship] = await this.db .insert(schema.memoryRelationships) .values({ fromMemoryId, toMemoryId, relationshipType, properties }) .returning(); return relationship; } catch (error) { console.warn('Memory relationships table not available:', error.message); return null; } }
- mcp.js:601-608 (registration)MCP tool dispatch/registration in the CallToolRequestSchema handler: maps tool call to memoryManager.createMemoryRelationship and formats response.case "create_memory_relationship": const relationship = await memoryManager.createMemoryRelationship( args.from_memory_id, args.to_memory_id, args.relationship_type, args.properties || {} ); return { content: [{ type: "text", text: JSON.stringify(relationship, null, 2) }] };
- mcp.js:221-247 (schema)Tool schema definition (input validation) provided in ListToolsRequestSchema response.name: "create_memory_relationship", description: "Create a relationship between two memories", inputSchema: { type: "object", properties: { from_memory_id: { type: "string", description: "UUID of the source memory" }, to_memory_id: { type: "string", description: "UUID of the target memory" }, relationship_type: { type: "string", enum: ["causal", "temporal", "semantic", "emotional", "strategic", "consolidation"], description: "Type of relationship" }, properties: { type: "object", description: "Additional properties for the relationship", default: {} } }, required: ["from_memory_id", "to_memory_id", "relationship_type"] } },