get_folders
Retrieve all folders within a ClickUp space to organize and access project structures. Provide the space ID to list available folders.
Instructions
Get all folders in a space
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_id | Yes | ClickUp space ID |
Implementation Reference
- Defines the get_folders tool, including its handler function that calls the folder service to retrieve folders.const getFoldersTool = defineTool((z) => ({ name: "get_folders", description: "Get all folders in a space", inputSchema: { space_id: z.string().describe("ClickUp space ID"), }, handler: async (input) => { const { space_id } = input; const response = await folderService.getFolders(space_id); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }, }));
- Input schema definition for the get_folders tool, specifying the required space_id parameter.inputSchema: { space_id: z.string().describe("ClickUp space ID"), },
- src/index.ts:20-20 (registration)Import statement for the getFoldersTool.import { getFoldersTool } from "./controllers/folder.controller";
- src/index.ts:41-41 (registration)Registration of getFoldersTool in the tools array, which is later used to register all tools with the MCP server.getFoldersTool,
- src/services/folder.service.ts:28-42 (helper)Helper service method that makes the API request to ClickUp to get folders in a space and processes the response.async getFolders(spaceId: string) { const response = await this.request<{ folders: any[] }>( `/space/${spaceId}/folder` ); // Remove the "lists" attribute from each folder to reduce payload size if (response.folders && Array.isArray(response.folders)) { response.folders = response.folders.map((folder) => { const { lists, ...folderWithoutLists } = folder; return folderWithoutLists; }); } return response; }