API Reference

memory_load_link

Import a subgraph into your knowledge graph

memory_load_link

Import an exported subgraph into your knowledge graph. Use to restore backups, share knowledge between agents, or migrate data.

Parameters

The exported subgraph JSON (from memory_export_subgraph).

Target graph for import. Defaults to your account’s default graph.

How to handle imported data. Options:

  • "append" (default): Create new nodes with new IDs
  • "replace": Replace existing nodes if IDs match (use with caution)

Prefix to add to all imported node IDs. Useful for namespacing imported data.

Example request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "memory_load_link",
    "arguments": {
      "data": {
        "nodes": [
          {
            "id": "node_abc123",
            "content": "Sarah Chen, Backend Tech Lead",
            "node_type": "person",
            "metadata": {"team": "backend"}
          }
        ],
        "edges": [
          {
            "edge_type": "manages",
            "source": "node_abc123",
            "target": "node_def456"
          }
        ],
        "hyperedges": []
      },
      "graph_id": "production",
      "merge_strategy": "append",
      "id_prefix": "imported_"
    }
  }
}

Example response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "import_id": "imp_xyz789",
    "imported_at": "2026-03-15T14:30:00Z",
    "target_graph": "production",
    "id_mapping": {
      "node_abc123": "imported_node_abc123",
      "node_def456": "imported_node_def456"
    },
    "stats": {
      "nodes_created": 2,
      "nodes_updated": 0,
      "nodes_skipped": 0,
      "edges_created": 1,
      "hyperedges_created": 0
    },
    "warnings": []
  }
}

Response fields

FieldTypeDescription
import_idstringUnique identifier for this import
imported_atstringImport timestamp
target_graphstringGraph data was imported to
id_mappingobjectMaps original IDs to new IDs
stats.nodes_creatednumberNew nodes created
stats.nodes_updatednumberExisting nodes updated (replace mode)
stats.nodes_skippednumberNodes skipped due to errors
stats.edges_creatednumberEdges created
stats.hyperedges_creatednumberHyperedges created
warningsarrayNon-fatal issues encountered

Errors

CodeDescription
INVALID_PARAMETERMissing data or invalid structure
INVALID_EXPORT_FORMATData doesn’t match export schema
NODE_LIMIT_EXCEEDEDImport would exceed node limit
GRAPH_NOT_FOUNDSpecified graph_id doesn’t exist

Notes

Free operation — Imports don’t count against your query limit.

Requires admin scope — This operation requires memory:admin scope.

Merge strategies

append (default)

  • All nodes get new IDs
  • Safe — never overwrites existing data
  • Use for: Sharing knowledge, adding new data

replace

  • Nodes with matching IDs are updated
  • Nodes without matches are created
  • Use for: Restoring backups, syncing data

Replace mode warningreplace can overwrite existing nodes. Only use when you’re sure you want to overwrite.

ID mapping

Imported nodes receive new IDs. Use the id_mapping response to track:

response = client.call_tool("memory_load_link", {"data": export_data})

# Find the new ID for an imported node
old_id = "node_abc123"
new_id = response["id_mapping"][old_id]

Edge handling

Edges reference node IDs. During import:

  1. Source and target IDs are mapped to new IDs
  2. If both nodes exist (imported or pre-existing), the edge is created
  3. If either node is missing, the edge is skipped (warning added)

Import validation

Before importing, the data is validated:

  • JSON structure matches export schema
  • All edge endpoints reference valid node IDs
  • Hyperedges have at least 3 nodes

Invalid items are skipped with warnings.

Use cases

Restore from backup:

{
  "data": backup_data,
  "merge_strategy": "replace"
}

Share knowledge between agents:

{
  "data": agent_a_export,
  "graph_id": "agent_b_graph",
  "id_prefix": "from_agent_a_"
}

Migrate to new graph:

{
  "data": old_graph_export,
  "graph_id": "new_graph",
  "merge_strategy": "append"
}

Large imports

For large imports (>1000 nodes):

  1. Consider batching into multiple smaller imports
  2. Monitor node limits before importing
  3. Use id_prefix to namespace batches
for batch in chunks(nodes, size=500):
    client.call_tool("memory_load_link", {
        "data": {"nodes": batch, "edges": [], "hyperedges": []},
        "id_prefix": f"batch_{batch_num}_"
    })