list_nodes
Retrieve nodes from Workflowy by specifying a parent ID to list child nodes or omit to fetch root nodes, enabling structured data access and organization.
Instructions
List nodes in Workflowy. If a parentId is provided, it lists the child nodes of that parent. If omitted, it lists the root nodes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parentId | No | ID of the parent node to list children from. If omitted, returns root nodes. |
Implementation Reference
- src/tools/workflowy.ts:10-29 (handler)The handler function that implements the core logic of the 'list_nodes' tool. It fetches and returns either root nodes or child nodes of a given parentId from Workflowy, handling errors gracefully.handler: async ({ parentId, username, password }: { parentId?: string, username?: string, password?: string }) => { try { const items = !!parentId ? await workflowyClient.getChildItems(parentId, username, password) : await workflowyClient.getRootItems(username, password); return { content: [{ type: "text", text: JSON.stringify(items, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error listing nodes: ${error.message}` }] }; } },
- src/tools/workflowy.ts:7-9 (schema)Zod-based input schema defining the optional 'parentId' parameter for the 'list_nodes' tool.inputSchema: { parentId: z.string().optional().describe("ID of the parent node to list children from. If omitted, returns root nodes.") },
- src/tools/index.ts:12-22 (registration)The registration function that adds the 'list_nodes' tool (along with others) to the FastMCP server by iterating over the toolRegistry and calling server.addTool.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 }); }); }
- src/tools/index.ts:6-9 (registration)Central tool registry where 'list_nodes' is included via the spread of workflowyTools.export const toolRegistry: Record<string, any> = { ...workflowyTools, // Add more tool categories here };
- src/index.ts:14-14 (registration)Invocation of the registerTools function in the main server setup, which registers the 'list_nodes' tool.registerTools(server);