Skip to main content
Glama

search_docs

Find documents in your ClickUp workspace by querying content. Returns matching documents with metadata for quick access.

Instructions

Search for docs in a ClickUp workspace using a query string. Returns matching docs with their metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_idYesThe ID of the workspace to search in
queryYesThe search query
cursorNoCursor for pagination

Implementation Reference

  • Registration of the 'search_docs' tool with the MCP server using Zod schema for input validation.
    // 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
          };
        }
      }
    );
  • Handler function that executes the search_docs tool logic: calls docsClient.searchDocs and returns JSON result.
    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
        };
      }
    }
  • Zod schema defining input parameters for search_docs: workspace_id (string), query (string), and optional cursor (string).
    {
      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')
    },
  • SearchDocsParams interface defining the parameters for the searchDocs API call: query and optional cursor.
    export interface SearchDocsParams {
      query: string;
      cursor?: string;
    }
  • searchDocs method on DocsClient that makes the actual HTTP GET request to ClickUp API v2 team docs/search endpoint.
    async searchDocs(workspaceId: string, params: SearchDocsParams): Promise<{ docs: Doc[], next_cursor: string }> {
      // Get the API token directly from the environment variable
      const apiToken = process.env.CLICKUP_API_TOKEN;
      
      try {
        // According to the ClickUp API documentation, the endpoint is:
        // GET /api/v2/team/{team_id}/docs/search
        // where team_id is the workspace ID
        const url = `https://api.clickup.com/api/v2/team/${workspaceId}/docs/search`;
        
        // Use the exact same headers that worked in the successful request
        const headers = {
          'Authorization': apiToken,
          'Accept': 'application/json'
        };
        
        // According to the ClickUp API documentation, this should be a GET request
        // with the parameters as query parameters
        const queryParams: any = {
          doc_name: params.query,
          cursor: params.cursor
        };
        
        // If the query is a space ID, use it as a space_id parameter
        if (params.query.startsWith('space:')) {
          const spaceId = params.query.substring(6);
          queryParams.space_id = spaceId;
          delete queryParams.doc_name;
        }
        
        const response = await axios.get(url, {
          headers,
          params: queryParams
        });
        
        return response.data;
      } catch (error) {
        console.error('Error searching docs:', error);
        throw error;
      }
    }
Behavior4/5

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

Without annotations, the description conveys a read-only search operation and return of metadata. It does not mention rate limits or auth, but for a simple read tool, the behavioral implications are adequately transparent.

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

Conciseness4/5

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

The description is a single concise sentence, front-loading the action and outcome. No wasted words, but could be slightly more detailed about return structure.

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?

The description covers the basic purpose and result but does not explain pagination via the cursor parameter or the format of returned metadata. Given the tool's simplicity and 100% schema coverage, it is mostly complete but has minor gaps.

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?

The input schema covers 100% of parameters with descriptions, so the baseline is 3. The description adds no additional parameter detail beyond the schema, such as explaining the cursor or query format.

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

Purpose5/5

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

The description clearly states the verb 'Search', the resource 'docs', the scope 'in a workspace using a query string', and what is returned ('matching docs with their metadata'). It distinguishes well from siblings like 'get_docs_from_workspace' (lists all) and 'get_doc_content' (specific doc content).

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

Usage Guidelines4/5

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

The description implies usage for searching docs by query, providing clear context. However, it does not explicitly exclude alternatives like listing all docs or when not to use the tool, so it lacks explicit when-not guidance.

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