Skip to main content
Glama

confluence_search

Search Confluence pages and content using CQL queries with optional filters by space and result limit.

Instructions

Search Confluence content using CQL (Confluence Query Language). Example queries: "type=page AND title~"API"", "type=page ORDER BY lastmodified DESC"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesCQL search query (e.g., "type=page AND title~\"keyword\"")
limitNoMaximum number of results (default: 10)
spaceKeyNoOptional space key to limit search to a specific space

Implementation Reference

  • index.js:48-62 (handler)
    The `searchContent` async function is the core handler for the confluence_search tool. It makes an HTTP GET request to the Confluence REST API `/content/search` endpoint with CQL query parameters, supports optional space key filtering, and returns the search results.
    async function searchContent(query, limit = 10, spaceKey = null) {
      try {
        let cql = query;
        if (spaceKey) {
          cql = `${query} AND space=${spaceKey}`;
        }
    
        const response = await client.get(`${CONFLUENCE_API_BASE}/content/search`, {
          params: { cql, limit, expand: 'space,version' }
        });
        return response.data;
      } catch (error) {
        throw new Error(`Failed to search content: ${error.message}`);
      }
    }
  • The `case 'confluence_search'` block in the CallToolRequestSchema handler dispatches the tool call, invokes `searchContent()` with the query, limit, and spaceKey arguments, and returns the JSON-stringified result.
    case 'confluence_search': {
      const result = await searchContent(
        args.query,
        args.limit || 10,
        args.spaceKey
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • index.js:231-251 (registration)
    The tool `confluence_search` is registered in the ListToolsRequestSchema handler with its name, description, and JSON Schema input schema (query string required, optional limit number, optional spaceKey string).
      name: 'confluence_search',
      description: 'Search Confluence content using CQL (Confluence Query Language). Example queries: "type=page AND title~\\"API\\"", "type=page ORDER BY lastmodified DESC"',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'CQL search query (e.g., "type=page AND title~\\"keyword\\"")',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results (default: 10)',
          },
          spaceKey: {
            type: 'string',
            description: 'Optional space key to limit search to a specific space',
          },
        },
        required: ['query'],
      },
    },
  • Supporting configuration and HTTP client setup: Confluence API base URL construction, authentication via email+API token, and axios client instance creation used by the searchContent handler.
    const ATLASSIAN_SITE = process.env.ATLASSIAN_SITE;
    const ATLASSIAN_EMAIL = process.env.ATLASSIAN_EMAIL;
    const ATLASSIAN_API_TOKEN = process.env.ATLASSIAN_API_TOKEN;
    
    // Validate configuration
    if (!ATLASSIAN_SITE || !ATLASSIAN_EMAIL || !ATLASSIAN_API_TOKEN) {
      console.error('ERROR: ATLASSIAN_SITE, ATLASSIAN_EMAIL, and ATLASSIAN_API_TOKEN must be set');
      process.exit(1);
    }
    
    // API Base URL
    const CONFLUENCE_API_BASE = `https://${ATLASSIAN_SITE}/wiki/rest/api`;
    
    // HTTP client with auth
    const client = axios.create({
      auth: {
        username: ATLASSIAN_EMAIL,
        password: ATLASSIAN_API_TOKEN,
      },
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
    });
  • Test script that exercises the confluence_search tool by calling it with a 'type=page' query and limit of 3, then validating the response.
    // Test search
    console.log('\nšŸ” Testing confluence_search...');
    const searchResult = await client.callTool({
      name: 'confluence_search',
      arguments: {
        query: 'type=page',
        limit: 3
      },
    });
    
    console.log('āœ… Success!');
    const searchData = JSON.parse(searchResult.content[0].text);
    console.log(`Found ${searchData.results?.length || 0} pages`);
Behavior2/5

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

No annotations are present, and the description does not disclose behavioral traits such as read-only nature, pagination, rate limits, or error handling.

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?

Two sentences with clear purpose and example queries; no unnecessary words.

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 no output schema and simple tool, the description covers the basic purpose and usage, but lacks behavioral context and return details.

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?

Schema coverage is 100%, and the example queries add value for the query parameter, though no additional info is given for limit or spaceKey.

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 that the tool searches Confluence content using CQL, with specific examples distinguishing it from sibling tools like create_page or get_page.

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

Usage Guidelines3/5

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

The description implies the tool is for searching, but does not explicitly provide when-to-use or when-not-to-use scenarios, nor mention alternatives.

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/gkrauchunas-arlo/confluence-mcp'

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