Skip to main content
Glama

toggle_complete

Mark a node as complete or incomplete in mcp-workflowy by specifying its ID and desired completion status.

Instructions

Toggle completion status of a node

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesID of the node to toggle completion status
completedYesWhether the node should be marked as complete (true) or incomplete (false)

Implementation Reference

  • Registration of the toggle_complete tool, including input schema (nodeId: string, completed: boolean) and handler that wraps the client call with error handling and response formatting.
    toggle_complete: {
      description: "Toggle completion status of a node",
      inputSchema: {
        nodeId: z.string().describe("ID of the node to toggle completion status"),
        completed: z.boolean().describe("Whether the node should be marked as complete (true) or incomplete (false)")
      },
      handler: async ({ nodeId, completed, username, password }:
          { nodeId: string, completed: boolean, username?: string, password?: string },
          client: typeof workflowyClient) => {
        try {
          await workflowyClient.toggleComplete(nodeId, completed, username, password);
          return {
            content: [{
              type: "text",
              text: `Successfully ${completed ? "completed" : "uncompleted"} node ${nodeId}`
            }]
          };
        } catch (error: any) {
          return {
            content: [{
              type: "text",
              text: `Error toggling completion status: ${error.message}`
            }]
          };
        }
      }
    }
  • Core implementation of toggleComplete in WorkflowyClient class: authenticates, finds the node by ID, sets completed status using Workflowy API, and saves changes if dirty.
    async toggleComplete(nodeId: string, completed: boolean, 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 (completed) {
            await node.setCompleted();
        } else {
            await node.setCompleted(false);
        }
    
        if (doc.isDirty()) {
            // Saves the changes if there are any
            await doc.save();
        }
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/danield137/mcp-workflowy'

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