Skip to main content
Glama

get_docs_from_workspace

Retrieve all documents from a ClickUp workspace with support for pagination and filtering by deleted or archived status.

Instructions

Get all docs from a ClickUp workspace. Supports pagination and filtering for deleted/archived docs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_idYesThe ID of the workspace to get docs from
cursorNoCursor for pagination
deletedNoWhether to include deleted docs
archivedNoWhether to include archived docs
limitNoThe maximum number of docs to return

Implementation Reference

  • The tool handler for 'get_docs_from_workspace'. Registers an MCP tool with zod schema for workspace_id (required), and optional cursor, deleted, archived, limit parameters. Calls docsClient.getDocsFromWorkspace() and returns JSON.stringify'd docs.
    // Register get_docs_from_workspace tool
    server.tool(
      'get_docs_from_workspace',
      'Get all docs from a ClickUp workspace. Supports pagination and filtering for deleted/archived docs.',
      {
        workspace_id: z.string().describe('The ID of the workspace to get docs from'),
        cursor: z.string().optional().describe('Cursor for pagination'),
        deleted: z.boolean().optional().describe('Whether to include deleted docs'),
        archived: z.boolean().optional().describe('Whether to include archived docs'),
        limit: z.number().optional().describe('The maximum number of docs to return')
      },
      async ({ workspace_id, cursor, deleted, archived, limit }) => {
        try {
          // Get docs from the workspace
          const result = await docsClient.getDocsFromWorkspace(workspace_id, { 
            cursor,
            deleted: deleted !== undefined ? deleted : false,
            archived: archived !== undefined ? archived : false,
            limit: limit || 50
          });
          
          return {
            content: [{ type: 'text', text: JSON.stringify(result.docs, null, 2) }]
          };
        } catch (error: any) {
          console.error('Error getting docs from workspace:', error);
          return {
            content: [{ type: 'text', text: `Error getting docs from workspace: ${error.message}` }],
            isError: true
          };
        }
      }
    );
  • Input validation schema for get_docs_from_workspace using zod: workspace_id (string, required), cursor (optional string), deleted (optional boolean), archived (optional boolean), limit (optional number).
    server.tool(
      'get_docs_from_workspace',
      'Get all docs from a ClickUp workspace. Supports pagination and filtering for deleted/archived docs.',
      {
        workspace_id: z.string().describe('The ID of the workspace to get docs from'),
        cursor: z.string().optional().describe('Cursor for pagination'),
        deleted: z.boolean().optional().describe('Whether to include deleted docs'),
        archived: z.boolean().optional().describe('Whether to include archived docs'),
        limit: z.number().optional().describe('The maximum number of docs to return')
      },
  • The setupDocTools() function that registers all doc tools (including get_docs_from_workspace) on the MCP server via server.tool(). Called from src/index.ts line 43.
    export function setupDocTools(server: McpServer): void {
      // Register get_doc_content tool
      server.tool(
        'get_doc_content',
        'Get the content of a specific ClickUp doc. Returns combined content from all pages in the doc.',
        {
          doc_id: z.string().describe('The ID of the doc to get'),
          workspace_id: z.string().describe('The ID of the workspace containing the doc')
        },
        async ({ doc_id, workspace_id }) => {
          try {
            // Get the pages of the doc
            const pages = await docsClient.getDocPages(workspace_id, doc_id);
            
            // Combine the content of all pages
            let combinedContent = '';
            if (Array.isArray(pages)) {
              for (const page of pages) {
                if (page.content) {
                  combinedContent += page.content + '\n\n';
                }
              }
            }
            
            return {
              content: [{ type: 'text', text: combinedContent || 'No content found in this doc.' }]
            };
          } catch (error: any) {
            console.error('Error getting doc content:', error);
            return {
              content: [{ type: 'text', text: `Error getting doc content: ${error.message}` }],
              isError: true
            };
          }
        }
      );
    
      // Register search_docs tool
      server.tool(
        'search_docs',
        'Search for docs in a ClickUp workspace using a query string. Returns matching docs with their metadata.',
        {
          workspace_id: z.string().describe('The ID of the workspace to search in'),
          query: z.string().describe('The search query'),
          cursor: z.string().optional().describe('Cursor for pagination')
        },
        async ({ workspace_id, query, cursor }) => {
          try {
            // Search for docs in the workspace
            const result = await docsClient.searchDocs(workspace_id, { query, cursor });
            
            return {
              content: [{ type: 'text', text: JSON.stringify(result.docs, null, 2) }]
            };
          } catch (error: any) {
            console.error('Error searching docs:', error);
            return {
              content: [{ type: 'text', text: `Error searching docs: ${error.message}` }],
              isError: true
            };
          }
        }
      );
    
      // Register get_docs_from_workspace tool
      server.tool(
        'get_docs_from_workspace',
        'Get all docs from a ClickUp workspace. Supports pagination and filtering for deleted/archived docs.',
        {
          workspace_id: z.string().describe('The ID of the workspace to get docs from'),
          cursor: z.string().optional().describe('Cursor for pagination'),
          deleted: z.boolean().optional().describe('Whether to include deleted docs'),
          archived: z.boolean().optional().describe('Whether to include archived docs'),
          limit: z.number().optional().describe('The maximum number of docs to return')
        },
        async ({ workspace_id, cursor, deleted, archived, limit }) => {
          try {
            // Get docs from the workspace
            const result = await docsClient.getDocsFromWorkspace(workspace_id, { 
              cursor,
              deleted: deleted !== undefined ? deleted : false,
              archived: archived !== undefined ? archived : false,
              limit: limit || 50
            });
            
            return {
              content: [{ type: 'text', text: JSON.stringify(result.docs, null, 2) }]
            };
          } catch (error: any) {
            console.error('Error getting docs from workspace:', error);
            return {
              content: [{ type: 'text', text: `Error getting docs from workspace: ${error.message}` }],
              isError: true
            };
          }
        }
      );
    
      // Register get_doc_pages tool
      server.tool(
        'get_doc_pages',
        'Get the pages of a specific ClickUp doc. Returns page content in the requested format (markdown or plain text).',
        {
          doc_id: z.string().describe('The ID of the doc to get pages from'),
          workspace_id: z.string().describe('The ID of the workspace containing the doc'),
          content_format: z.enum(['text/md', 'text/plain']).optional().describe('The format to return the content in')
        },
        async ({ doc_id, workspace_id, content_format }) => {
          try {
            // Get the pages of the doc
            const pages = await docsClient.getDocPages(workspace_id, doc_id, content_format);
            
            return {
              content: [{ type: 'text', text: JSON.stringify(pages, null, 2) }]
            };
          } catch (error: any) {
            console.error('Error getting doc pages:', error);
            return {
              content: [{ type: 'text', text: `Error getting doc pages: ${error.message}` }],
              isError: true
            };
          }
        }
      );
    }
  • The DocsClient.getDocsFromWorkspace() method that makes the actual HTTP GET request to the ClickUp API v3 endpoint (workspaces/{workspaceId}/docs) with optional query parameters (cursor, deleted, archived, limit).
    async getDocsFromWorkspace(workspaceId: string, params?: GetDocsParams): Promise<{ docs: Doc[], next_cursor: string }> {
      // Get the API token directly from the environment variable
      const apiToken = process.env.CLICKUP_API_TOKEN;
      
      try {
        const url = `https://api.clickup.com/api/v3/workspaces/${workspaceId}/docs`;
        
        // Use the exact same headers that worked in the successful request
        const headers = {
          'Authorization': apiToken,
          'Accept': 'application/json'
        };
        
        const response = await axios.get(url, {
          headers,
          params
        });
        
        return response.data;
      } catch (error) {
        console.error('Error getting docs:', error);
        throw error;
      }
    }
  • The GetDocsParams interface defining optional parameters: cursor (string), deleted (boolean), archived (boolean), limit (number).
    export interface GetDocsParams {
      cursor?: string;
      deleted?: boolean;
      archived?: boolean;
      limit?: number;
    }
Behavior3/5

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

The description mentions support for pagination and filtering (deleted/archived), but lacks explicit statements about being read-only, authentication requirements, or error handling. With no annotations, the description carries the full burden and could be more comprehensive.

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 very concise at two sentences, front-loading the main purpose. Every sentence adds value, with no redundant or extraneous information.

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

Completeness2/5

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

Despite having no output schema, the description omits return value details and pagination mechanics (e.g., cursor usage). For a list tool with five parameters, additional context about output and behavior is needed for completeness.

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

Parameters3/5

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

Schema coverage is 100%, so the baseline is 3. The description echoes the schema (pagination, deleted, archived) without adding new semantic meaning beyond what the schema already provides.

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 tool retrieves all docs from a ClickUp workspace with pagination and filtering. However, it does not explicitly differentiate from siblings like search_docs, which may have overlapping capabilities.

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 such as search_docs or get_doc_content. The description only states what the tool does without contextual usage advice.

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

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