update_node
Modify an existing node's name and description in mcp-workflowy by providing the node ID and new content values.
Instructions
Update an existing node
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | ID of the node to update | |
| name | No | New name/title for the node | |
| description | No | New description/note for the node |
Implementation Reference
- src/tools/workflowy.ts:116-134 (handler)The MCP tool handler for 'update_node', which authenticates via credentials if provided, calls the underlying workflowyClient.updateNode method, and returns success/error messages.handler: async ({ nodeId, name, description, username, password }: { nodeId: string, name?: string, description?: string, username?: string, password?: string }, client: typeof workflowyClient) => { try { await workflowyClient.updateNode(nodeId, name, description, username, password); return { content: [{ type: "text", text: `Successfully updated node ${nodeId}` }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error updating node: ${error.message}` }] }; }
- src/tools/workflowy.ts:104-108 (schema)Zod-based input schema defining parameters for the update_node tool: required nodeId, optional name and description.inputSchema: { nodeId: z.string().describe("ID of the node to update"), name: z.string().optional().describe("New name/title for the node"), description: z.string().optional().describe("New description/note for the node") },
- src/tools/index.ts:6-9 (registration)Central tool registry that includes all workflowyTools (including update_node) via spread operator.export const toolRegistry: Record<string, any> = { ...workflowyTools, // Add more tool categories here };
- src/workflowy/client.ts:100-118 (helper)Underlying helper method in WorkflowyClient that locates the node by ID, updates name and/or description if provided, and saves the document changes.async updateNode(nodeId: string, name?: string, description?: string, username?: string, password?: string) { const { wf } = await this.createAuthenticatedClient(username, password); const doc = await wf.getDocument(); const node = doc.root.items.find(item => item.id === nodeId); if (!node) { throw new Error(`Node with ID ${nodeId} not found.`); } if (name !== undefined) { node.setName(name); } if (description !== undefined) { node.setNote(description); } if (doc.isDirty()) { // Saves the changes if there are any await doc.save(); } }