Skip to main content
Glama
aaronsb

Confluence MCP Server

search_confluence_pages

Search Confluence pages using text or advanced queries to find relevant documentation, pages in specific spaces, or content by metadata.

Instructions

Search across Confluence pages using simple text or CQL (Confluence Query Language).

Query Types:

  1. Simple Text Search:

    • Just provide the search term directly (e.g., "documentation")

    • The system automatically wraps it in proper CQL syntax

  2. Advanced CQL Search:

    • Must include "type =" to signal raw CQL usage

    • Examples:

      • type = "page" AND text ~ "project"

      • type = "page" AND space.key = "TEAM"

      • type = "page" AND created >= "2024-01-01"

Search Capabilities:

  • Full text search across all pages

  • Space-specific searches

  • Content type filtering

  • Metadata-based filtering

CQL Operators (for advanced queries):

  • ~ : contains

  • = : equals

  • != : not equals

  • AND, OR : combine conditions

  • () : group conditions

  • = <= : date comparisons

  • IN : multiple values

Common Search Patterns:

  • Finding pages in specific space: type = "page" AND space.key = "SPACENAME" AND text ~ "searchterm"

  • Finding recent pages: type = "page" AND created >= "2024-01-01" AND text ~ "searchterm"

  • Finding pages by title: type = "page" AND title ~ "exactname"

  • Finding pages by label: type = "page" AND label = "labelname"

Response includes:

  • Page ID, title, and type

  • Space information

  • URL to the page

  • Last modified date

  • Content excerpt with search term highlighting

Pagination:

  • Use 'limit' to control results per page (default: 25)

  • Use 'start' for pagination offset

Workflow Tips:

  1. Start with list_confluence_spaces to get space keys

  2. Use space-specific searches for better results

  3. Use the returned pageId with get_confluence_page for full content

  4. Look for highlighted excerpts in results to identify most relevant matches

Best Practices:

  1. Start with simple text searches when possible

  2. Use advanced CQL (with 'type =') for complex queries

  3. Use space-specific searches for better performance

  4. Use get_confluence_page to fetch full content of found pages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query - either simple text (e.g., 'documentation') or CQL query (must include 'type =' for CQL mode, e.g., 'type = "page" AND text ~ "project"')
limitNoMaximum number of results to return (default: 25)
startNoStarting index for pagination (default: 0)

Implementation Reference

  • Main handler function implementing the search_confluence_pages tool. Validates input, calls ConfluenceClient.searchConfluenceContent, simplifies results, and returns JSON-formatted response.
    export async function handleSearchConfluencePages(
      client: ConfluenceClient,
      args: { query: string; limit?: number; start?: number }
    ): Promise<{
      content: Array<{ type: "text"; text: string }>;
    }> {
      try {
        if (!args.query) {
          throw new McpError(ErrorCode.InvalidParams, "query is required");
        }
    
        const results = await client.searchConfluenceContent(args.query, args.limit, args.start);
        const simplified = {
          results: results.results.map(result => ({
            id: result.content.id,
            title: result.content.title,
            type: result.content.type,
            url: result.url,
            excerpt: result.excerpt || null
          })),
          next: results._links.next ? true : false
        };
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(simplified),
            },
          ],
        };
      } catch (error) {
        console.error("Error searching pages:", error instanceof Error ? error.message : String(error));
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to search pages: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • src/index.ts:250-258 (registration)
    Registration of the search_confluence_pages tool in the main switch statement handling tool calls.
    case "search_confluence_pages": {
      const { query, limit, start } = (args || {}) as { 
        query: string; 
        limit?: number; 
        start?: number 
      };
      if (!query) throw new McpError(ErrorCode.InvalidParams, "query is required");
      return await handleSearchConfluencePages(this.confluenceClient, { query, limit, start });
    }
  • Schema definition for search_confluence_pages tool including detailed description and input schema with query (required), limit, and start parameters.
    search_confluence_pages: {
      description: "Search across Confluence pages using simple text or CQL (Confluence Query Language).\n\nQuery Types:\n\n1. Simple Text Search:\n   - Just provide the search term directly (e.g., \"documentation\")\n   - The system automatically wraps it in proper CQL syntax\n\n2. Advanced CQL Search:\n   - Must include \"type =\" to signal raw CQL usage\n   - Examples:\n     * type = \"page\" AND text ~ \"project\"\n     * type = \"page\" AND space.key = \"TEAM\"\n     * type = \"page\" AND created >= \"2024-01-01\"\n\nSearch Capabilities:\n- Full text search across all pages\n- Space-specific searches\n- Content type filtering\n- Metadata-based filtering\n\nCQL Operators (for advanced queries):\n- ~ : contains\n- = : equals\n- != : not equals\n- AND, OR : combine conditions\n- () : group conditions\n- >= <= : date comparisons\n- IN : multiple values\n\nCommon Search Patterns:\n- Finding pages in specific space: type = \"page\" AND space.key = \"SPACENAME\" AND text ~ \"searchterm\"\n- Finding recent pages: type = \"page\" AND created >= \"2024-01-01\" AND text ~ \"searchterm\"\n- Finding pages by title: type = \"page\" AND title ~ \"exactname\"\n- Finding pages by label: type = \"page\" AND label = \"labelname\"\n\nResponse includes:\n- Page ID, title, and type\n- Space information\n- URL to the page\n- Last modified date\n- Content excerpt with search term highlighting\n\nPagination:\n- Use 'limit' to control results per page (default: 25)\n- Use 'start' for pagination offset\n\nWorkflow Tips:\n1. Start with list_confluence_spaces to get space keys\n2. Use space-specific searches for better results\n3. Use the returned pageId with get_confluence_page for full content\n4. Look for highlighted excerpts in results to identify most relevant matches\n\nBest Practices:\n1. Start with simple text searches when possible\n2. Use advanced CQL (with 'type =') for complex queries\n3. Use space-specific searches for better performance\n4. Use get_confluence_page to fetch full content of found pages",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query - either simple text (e.g., 'documentation') or CQL query (must include 'type =' for CQL mode, e.g., 'type = \"page\" AND text ~ \"project\"')",
          },
          limit: {
            type: "number",
            description: "Maximum number of results to return (default: 25)",
          },
          start: {
            type: "number",
            description: "Starting index for pagination (default: 0)",
          },
        },
        required: ["query"],
      },
    },
  • src/index.ts:29-29 (registration)
    Import of the handleSearchConfluencePages handler function used in tool registration.
    handleSearchConfluencePages,
Behavior4/5

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

With no annotations provided, the description carries full burden and delivers substantial behavioral context. It discloses response format details (page ID, title, type, space info, URL, dates, excerpts with highlighting), pagination behavior (limit default 25, start for offset), and performance considerations (space-specific searches for better performance). It doesn't mention rate limits or authentication needs, but covers most other behavioral aspects thoroughly.

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

Conciseness3/5

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

The description is well-structured with clear sections (Query Types, Search Capabilities, CQL Operators, Common Search Patterns, etc.), but it's quite lengthy with multiple bullet lists and could be more front-loaded. While all content is relevant, some redundancy exists (e.g., CQL examples appear in multiple sections), reducing conciseness.

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

Completeness5/5

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

Given the complexity of a search tool with multiple query modes, no annotations, and no output schema, the description provides exceptional completeness. It covers purpose, usage guidelines, behavioral details (response format, pagination), parameter context, workflow integration with sibling tools, and best practices - everything needed for effective tool selection and invocation.

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 description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds some value by explaining the two query modes (simple text vs. CQL with 'type =') and providing extensive examples, but doesn't add significant semantic meaning beyond what's in the schema descriptions. Baseline 3 is appropriate when schema does the heavy lifting.

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 explicitly states the tool's purpose as 'Search across Confluence pages using simple text or CQL (Confluence Query Language)', which is a specific verb+resource+method combination. It clearly distinguishes this from siblings like 'list_confluence_pages' (which likely lists without search) and 'find_confluence_page' (which may find by ID rather than query).

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool versus alternatives, including 'Start with list_confluence_spaces to get space keys' and 'Use get_confluence_page to fetch full content of found pages'. It also distinguishes between simple text searches and advanced CQL usage with clear 'when' criteria (CQL must include 'type =').

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/aaronsb/confluence-cloud-mcp'

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