toggle_complete
Mark a Workflowy node as complete or incomplete by specifying its ID and the completion status. Update task status directly without manual editing.
Instructions
Toggle completion status of a node
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | ID of the node to toggle completion status | |
| completed | Yes | Whether the node should be marked as complete (true) or incomplete (false) |
Implementation Reference
- src/tools/workflowy.ts:179-205 (handler)The handler function for the 'toggle_complete' tool. It accepts nodeId and completed parameters, calls workflowyClient.toggleComplete(), and returns a success or error message.
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}` }] }; } } } - src/tools/workflowy.ts:181-184 (schema)Input schema for the toggle_complete tool: requires nodeId (string) and completed (boolean).
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)") }, - src/workflowy/client.ts:185-203 (helper)The WorkflowyClient.toggleComplete() method that finds the node by ID and calls node.setCompleted() or node.setCompleted(false), then saves the document.
async toggleComplete(nodeId: string, completed: boolean, username?: string, password?: string) { const { wf } = await this.createAuthenticatedClient(username, password); const doc = await wf.getDocument(); const node = this.findNodeById(doc.root, 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(); } } - src/tools/index.ts:12-22 (registration)The registerTools function that iterates over toolRegistry (which includes toggle_complete from workflowyTools) and registers each tool with the FastMCP server.
export function registerTools(server: FastMCP): void { Object.entries(toolRegistry).forEach(([name, tool]) => { server.addTool({ name, description: tool.description, parameters: z.object(tool.inputSchema), annotations: tool.annotations, execute: tool.handler }); }); }