Skip to main content
Glama

create_memory_relationship

Establish connections between stored memories to build associative networks for AI systems, enabling relationship-based memory organization and retrieval.

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

  • The core implementation of createMemoryRelationship method that inserts a relationship record into the memory_relationships table with from_memory_id, to_memory_id, relationship_type, and optional properties fields.
    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;
      }
    }
  • Input schema definition for create_memory_relationship tool, specifying required parameters (from_memory_id, to_memory_id, relationship_type) and optional properties, with relationship_type enum including causal, temporal, semantic, emotional, strategic, and consolidation.
    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"]
    }
  • mcp.js:221-247 (registration)
    MCP server tool registration for create_memory_relationship in the ListToolsRequestSchema handler, exposing the tool with its description and input schema.
      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"]
      }
    },
  • mcp.js:601-608 (registration)
    Handler dispatch in CallToolRequestSchema that routes create_memory_relationship calls to memoryManager.createMemoryRelationship method, passing arguments and returning JSON 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) }] };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Create' which implies a write/mutation operation, but doesn't disclose any behavioral traits: no information about permissions needed, whether it's idempotent, what happens on duplicate relationships, error conditions, or response format. This leaves significant gaps for a tool that modifies data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that states the core function without unnecessary words. It's front-loaded with the essential action and resource. There's zero waste or redundancy—every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't cover behavioral aspects (permissions, side effects), response format, or error handling. While the schema documents parameters well, the overall context for safe and effective use is incomplete, especially given the tool modifies data in what appears to be a memory system.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing good documentation for all parameters. The description adds no parameter semantics beyond what's in the schema—it doesn't explain what 'relationship' means in this context, how properties are used, or provide examples. With high schema coverage, the baseline is 3, and the description doesn't enhance or detract from that.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('relationship between two memories'), making the purpose immediately understandable. It distinguishes from sibling tools like 'get_memory_relationships' (which retrieves) and 'create_memory' (which creates individual memories). However, it doesn't specify what kind of relationship (e.g., directional, with types) beyond the basic concept.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., existing memories), exclusions, or comparisons to siblings like 'find_related_memories' or 'create_memory_cluster'. The agent must infer usage from the name and schema alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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