move_node
Relocate a node to a new position within a Dynalist document by specifying a new parent node and optional index position.
Instructions
Move a node to a different location in a Dynalist document
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Dynalist URL | |
| file_id | No | Document ID (alternative to URL) | |
| node_id | Yes | Node ID to move | |
| parent_id | Yes | New parent node ID | |
| index | No | Position under new parent (-1 = end, 0 = top) |
Implementation Reference
- src/tools/index.ts:824-851 (handler)Handler function that parses input, determines document ID, and calls client.editDocument with 'move' action to relocate the specified node.async ({ url, file_id, node_id, parent_id, index }) => { let documentId = file_id; if (url) { const parsed = parseDynalistUrl(url); documentId = parsed.documentId; } if (!documentId) { return { content: [{ type: "text", text: "Error: Either 'url' or 'file_id' must be provided" }], isError: true, }; } await client.editDocument(documentId, [ { action: "move", node_id, parent_id, index } ]); return { content: [ { type: "text", text: `Node moved successfully!\nDocument: ${documentId}\nNode: ${node_id}\nNew Parent: ${parent_id}\nNew URL: ${buildDynalistUrl(documentId, node_id)}`, }, ], }; }
- src/tools/index.ts:817-823 (schema)Zod schema defining the input parameters for the move_node tool.{ url: z.string().optional().describe("Dynalist URL"), file_id: z.string().optional().describe("Document ID (alternative to URL)"), node_id: z.string().describe("Node ID to move"), parent_id: z.string().describe("New parent node ID"), index: z.number().optional().default(-1).describe("Position under new parent (-1 = end, 0 = top)"), },
- src/tools/index.ts:814-852 (registration)Registration of the move_node tool using server.tool() in the registerTools function.server.tool( "move_node", "Move a node to a different location in a Dynalist document", { url: z.string().optional().describe("Dynalist URL"), file_id: z.string().optional().describe("Document ID (alternative to URL)"), node_id: z.string().describe("Node ID to move"), parent_id: z.string().describe("New parent node ID"), index: z.number().optional().default(-1).describe("Position under new parent (-1 = end, 0 = top)"), }, async ({ url, file_id, node_id, parent_id, index }) => { let documentId = file_id; if (url) { const parsed = parseDynalistUrl(url); documentId = parsed.documentId; } if (!documentId) { return { content: [{ type: "text", text: "Error: Either 'url' or 'file_id' must be provided" }], isError: true, }; } await client.editDocument(documentId, [ { action: "move", node_id, parent_id, index } ]); return { content: [ { type: "text", text: `Node moved successfully!\nDocument: ${documentId}\nNode: ${node_id}\nNew Parent: ${parent_id}\nNew URL: ${buildDynalistUrl(documentId, node_id)}`, }, ], }; } );