Skip to main content
Glama
QuixiAI

AGI MCP Server

by QuixiAI

create_memory_relationship

Link two memories in an AI system by establishing causal, temporal, semantic, emotional, strategic, or consolidation relationships to enable memory continuity and contextual understanding.

Instructions

Create a relationship between two memories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_memory_idYesUUID of the source memory
to_memory_idYesUUID of the target memory
relationship_typeYesType of relationship
propertiesNoAdditional properties for the relationship

Implementation Reference

  • Core handler function that executes the tool logic: inserts a new memory relationship record into the memoryRelationships table using Drizzle ORM.
    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 (handler)
    MCP CallToolRequest dispatch handler that extracts arguments and calls the core memoryManager.createMemoryRelationship function, returning JSON result.
    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) }] };
  • Input schema definition for the tool, used in MCP ListToolsRequestHandler to describe parameters and validation.
      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"]
      }
    },
  • Input schema definition in memoryTools export array (reference or source schema matching the one used in mcp.js).
      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"]
      }
    },

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/QuixiAI/agi-mcp-server'

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