Skip to main content
Glama

upsert_memory_node

Create or update memory nodes in a semantic graph to represent concepts, files, symbols, or notes with auto-generated embeddings for linking and retrieval.

Instructions

Create or update a memory node in the linking graph. Nodes represent concepts, files, symbols, or notes with auto-generated embeddings. If a node with the same label and type exists, it updates content and increments access count. Returns the node ID for use in create_relation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesNode type: concept (abstract ideas), file (source files), symbol (functions/classes), note (free-form).
labelYesShort identifier for the node. Used for deduplication with type.
contentYesDetailed content for the node. Used for embedding generation.
metadataNoOptional key-value metadata pairs.

Implementation Reference

  • The `toolUpsertMemoryNode` function wraps the `upsertNode` core logic, executing the upsert and returning a formatted summary of the operation and graph state.
    export async function toolUpsertMemoryNode(options: UpsertMemoryNodeOptions): Promise<string> {
      const node = await upsertNode(options.rootDir, options.type, options.label, options.content, options.metadata);
      const stats = await getGraphStats(options.rootDir);
      return [
        `✅ Memory node upserted: ${node.label}`,
        `  ID: ${node.id}`,
        `  Type: ${node.type}`,
        `  Access count: ${node.accessCount}`,
        `\nGraph: ${stats.nodes} nodes, ${stats.edges} edges`,
      ].join("\n");
    }
  • The `UpsertMemoryNodeOptions` interface defines the input structure required for the `upsert_memory_node` tool.
    export interface UpsertMemoryNodeOptions {
      rootDir: string;
      type: NodeType;
      label: string;
      content: string;
      metadata?: Record<string, string>;
    }

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/ForLoopCodes/contextplus'

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