Skip to main content
Glama
windalfin

ClickUp MCP Server

by windalfin

get_workspace_hierarchy

Retrieve the complete workspace structure including spaces, folders, and lists to understand ClickUp organization and relationships.

Instructions

Get the complete workspace hierarchy including spaces, folders, and lists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main tool handler that calls the workspace service to get the hierarchy and formats the response as a text tree.
    export async function handleGetWorkspaceHierarchy() {
      try {
        // Get workspace hierarchy from the workspace service
        const hierarchy = await workspaceService.getWorkspaceHierarchy();
        const response = formatHierarchyResponse(hierarchy);
        return response;
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `Error getting workspace hierarchy: ${error.message}`
            }
          ]
        };
      }
    }
  • Tool schema defining the get_workspace_hierarchy tool with no input parameters.
    export const workspaceHierarchyTool: Tool = {
      name: 'get_workspace_hierarchy',
      description: 'Get the complete workspace hierarchy including spaces, folders, and lists.',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    };
  • src/server.ts:100-101 (registration)
    Dispatch registration in the CallToolRequestHandler switch statement.
    case "get_workspace_hierarchy":
      return handleGetWorkspaceHierarchy();
  • src/server.ts:67-92 (registration)
    Tool list registration including get_workspace_hierarchy in ListToolsRequestHandler. Note: excerpt abbreviated.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          workspaceHierarchyTool,
          createTaskTool,
          getTaskTool,
          getTasksTool,
          updateTaskTool,
          moveTaskTool,
          duplicateTaskTool,
          deleteTaskTool,
          createBulkTasksTool,
          updateBulkTasksTool,
          moveBulkTasksTool,
          deleteBulkTasksTool,
          createListTool,
          createListInFolderTool,
          getListTool,
          updateListTool,
          deleteListTool,
          createFolderTool,
          getFolderTool,
          updateFolderTool,
          deleteFolderTool
        ]
      };
  • Core helper service method that retrieves and constructs the workspace hierarchy tree from ClickUp API endpoints.
    async getWorkspaceHierarchy(forceRefresh = false): Promise<WorkspaceTree> {
      try {
        // If we have the hierarchy in memory and not forcing refresh, return it
        if (this.workspaceHierarchy && !forceRefresh) {
          return this.workspaceHierarchy;
        }
    
        // Start building the workspace tree
        const workspaceTree: WorkspaceTree = {
          root: {
            id: this.teamId,
            name: 'Workspace',
            children: []
          }
        };
    
        // Get all spaces
        const spaces = await this.getSpaces();
    
        // Process each space
        for (const space of spaces) {
          const spaceNode: WorkspaceNode = {
            id: space.id,
            name: space.name,
            type: 'space',
            children: []
          };
    
          // Get folders for the space
          const folders = await this.getFoldersInSpace(space.id);
          for (const folder of folders) {
            const folderNode: WorkspaceNode = {
              id: folder.id,
              name: folder.name,
              type: 'folder',
              parentId: space.id,
              children: []
            };
    
            // Get lists in the folder
            const listsInFolder = await this.getListsInFolder(folder.id);
            for (const list of listsInFolder) {
              folderNode.children?.push({
                id: list.id,
                name: list.name,
                type: 'list',
                parentId: folder.id
              });
            }
    
            spaceNode.children?.push(folderNode);
          }
    
          // Get lists directly in the space (not in any folder)
          const listsInSpace = await this.getListsInSpace(space.id);
          for (const list of listsInSpace) {
            spaceNode.children?.push({
              id: list.id,
              name: list.name,
              type: 'list',
              parentId: space.id
            });
          }
    
          workspaceTree.root.children.push(spaceNode);
        }
    
        // Store the hierarchy for later use
        this.workspaceHierarchy = workspaceTree;
        return workspaceTree;
      } catch (error) {
        throw this.handleError(error, 'Failed to get workspace hierarchy');
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data ('Get'), implying a read-only operation, but doesn't specify aspects like authentication requirements, rate limits, error handling, or the format of the returned hierarchy. This leaves significant gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters, no annotations, and no output schema, the description provides a basic understanding of what it does but lacks details on behavior, output format, and usage context. It's minimally viable but incomplete for effective agent use without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and it doesn't introduce any confusion, earning a baseline score of 4 for this scenario.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and the resource ('complete workspace hierarchy including spaces, folders, and lists'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_folder' or 'get_list', which retrieve specific components rather than the entire hierarchy.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'get_folder' or 'get_list'. The description implies it retrieves a broader scope, but it lacks explicit recommendations, prerequisites, or exclusions for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/windalfin/clickup-mcp-server'

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