Skip to main content
Glama

Memory Add Relation

localnest_memory_add_relation
Idempotent

Link two memory entries with a named relation to build a traversable knowledge graph. Use for connections like 'depends_on', 'contradicts', or 'supersedes'.

Instructions

Link two memory entries with a named relation. Use to build a traversable knowledge graph (e.g. "depends_on", "contradicts", "supersedes", "related").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_idYes
target_idYes
relation_typeNorelated
response_formatNojson

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
metaNo

Implementation Reference

  • The handler function for the localnest_memory_add_relation tool, which calls the memory service to create the relation.
    async ({ source_id, target_id, relation_type }) => {
      const result = await memory.addRelation(source_id, target_id, relation_type);
      return normalizeRelationResult(result, { source_id, target_id, relation_type });
    }
  • Registration of the localnest_memory_add_relation tool in the memory store toolset.
    registerJsonTool(
      ['localnest_memory_add_relation'],
      {
        title: 'Memory Add Relation',
        description: 'Link two memory entries with a named relation. Use to build a traversable knowledge graph (e.g. "depends_on", "contradicts", "supersedes", "related").',
        inputSchema: {
          source_id: z.string().min(1),
          target_id: z.string().min(1),
          relation_type: z.string().min(1).max(60).default('related')
        },
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false
        }
      },
      async ({ source_id, target_id, relation_type }) => {
        const result = await memory.addRelation(source_id, target_id, relation_type);
        return normalizeRelationResult(result, { source_id, target_id, relation_type });
      }
    );
Behavior4/5

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

Description complements annotations effectively. While annotations declare idempotentHint=true and destructiveHint=false, the description adds crucial behavioral context through the example relation types (depends_on, contradicts, supersedes), clarifying the semantic richness supported. It also explains the structural outcome (knowledge graph) beyond what annotations provide.

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?

Two sentences with zero waste. First sentence states the core operation; second provides use-case context and examples. Every word earns its place—no redundancy with schema or annotations.

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

Completeness4/5

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

Adequately complete for a graph-building operation. The combination of clear description, helpful examples, and present annotations (readOnlyHint, idempotentHint) covers essential behavioral contracts. Output schema exists, so return value description isn't required. Minor gap: doesn't mention that relation_type is optional (defaults to 'related').

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

Parameters4/5

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

Despite 0% schema description coverage, the description successfully compensates by mapping the abstract concept to parameters: 'Link two memory entries' clarifies source_id/target_id are memory entry identifiers, and 'named relation' with examples maps to relation_type. Could explicitly state that relation_type defaults to 'related', but the mention of 'related' as an example provides implicit guidance.

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

Purpose5/5

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

Excellent specificity: 'Link two memory entries with a named relation' provides clear verb (link), resource (memory entries), and mechanism (named relation). The phrase 'traversable knowledge graph' distinguishes this from simple tagging or storage operations, clearly differentiating it from siblings like localnest_memory_store or localnest_memory_get.

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

Usage Guidelines4/5

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

Provides explicit positive guidance ('Use to build a traversable knowledge graph') with concrete semantic examples (depends_on, contradicts, supersedes). Lacks explicit negative guidance or named alternatives (e.g., doesn't mention localnest_memory_remove_relation for deletion), but the sibling naming convention (add vs remove) provides implicit contrast.

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/wmt-mobile/localnest'

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