Skip to main content
Glama

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
NameRequiredDescriptionDefault
urlNoDynalist URL
file_idNoDocument ID (alternative to URL)
node_idYesNode ID to move
parent_idYesNew parent node ID
indexNoPosition under new parent (-1 = end, 0 = top)

Implementation Reference

  • 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)}`,
          },
        ],
      };
    }
  • 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)"),
    },
  • 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)}`,
            },
          ],
        };
      }
    );

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/cristip73/dynalist-mcp'

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