Skip to main content
Glama

update_nodes

Modify existing nodes in the MemoryMesh knowledge graph by updating node types, metadata, or other properties, ensuring accurate and dynamic data representation.

Instructions

Update existing nodes in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodesYesArray of nodes to update

Implementation Reference

  • The tool handler case for 'update_nodes' that executes the update by delegating to knowledgeGraphManager.updateNodes and returns formatted response.
    case "update_nodes": const updatedNodes = await this.knowledgeGraphManager.updateNodes(args.nodes); return formatToolResponse({ data: {nodes: updatedNodes}, actionTaken: "Updated nodes in knowledge graph" });
  • Input schema defining the structure for update_nodes tool arguments: array of partial nodes with required 'name'.
    inputSchema: { type: "object", properties: { nodes: { type: "array", description: "Array of nodes to update", items: { type: "object", description: "Node to update", properties: { name: {type: "string", description: "The name of the node to update"}, nodeType: {type: "string", description: "The new type of the node"}, metadata: { type: "array", items: {type: "string", description: "Metadata item"}, description: "An array of new metadata contents for the node" }, }, required: ["name"], }, }, }, required: ["nodes"], },
  • Registers all static tools (including update_nodes) from allStaticTools into the central tools Map.
    // Register static tools allStaticTools.forEach(tool => { this.tools.set(tool.name, tool); });
  • Core helper function implementing node updates: validates, finds and merges partial node data into graph, persists changes.
    async updateNodes(nodes: Partial<Node>[]): Promise<Node[]> { try { this.emit('beforeUpdateNodes', {nodes}); const graph = await this.storage.loadGraph(); const updatedNodes: Node[] = []; for (const updateNode of nodes) { GraphValidator.validateNodeNameProperty(updateNode); const nodeIndex = graph.nodes.findIndex(n => n.name === updateNode.name); if (nodeIndex === -1) { throw new Error(`Node not found: ${updateNode.name}`); } graph.nodes[nodeIndex] = { ...graph.nodes[nodeIndex], ...updateNode }; updatedNodes.push(graph.nodes[nodeIndex]); } await this.storage.saveGraph(graph); this.emit('afterUpdateNodes', {nodes: updatedNodes}); return updatedNodes; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; throw new Error(errorMessage); }

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/CheMiguel23/MemoryMesh'

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