Skip to main content
Glama
aashari

Atlassian Confluence MCP Server

by aashari

Confluence GET Request

conf_get

Retrieve Confluence data from API endpoints using path parameters and optional filters to extract specific information efficiently.

Instructions

Read any Confluence data. Returns TOON format by default (30-60% fewer tokens than JSON).

IMPORTANT - Cost Optimization:

  • ALWAYS use jq param to filter response fields. Unfiltered responses are very expensive!

  • Use limit query param to restrict result count (e.g., limit: "5")

  • If unsure about available fields, first fetch ONE item with limit: "1" and NO jq filter to explore the schema, then use jq in subsequent calls

Schema Discovery Pattern:

  1. First call: path: "/wiki/api/v2/spaces", queryParams: {"limit": "1"} (no jq) - explore available fields

  2. Then use: jq: "results[*].{id: id, key: key, name: name}" - extract only what you need

Output format: TOON (default, token-efficient) or JSON (outputFormat: "json")

Common paths:

  • /wiki/api/v2/spaces - list spaces

  • /wiki/api/v2/pages - list pages (use space-id query param)

  • /wiki/api/v2/pages/{id} - get page details

  • /wiki/api/v2/pages/{id}/body - get page body (body-format: storage, atlas_doc_format, view)

  • /wiki/rest/api/search - search content (cql query param)

JQ examples: results[*].id, results[0], results[*].{id: id, title: title}

API reference: https://developer.atlassian.com/cloud/confluence/rest/v2/

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe Confluence API endpoint path (without base URL). Must start with "/". Examples: "/wiki/api/v2/spaces", "/wiki/api/v2/pages", "/wiki/api/v2/pages/{id}"
queryParamsNoOptional query parameters as key-value pairs. Examples: {"limit": "25", "cursor": "...", "space-id": "123", "body-format": "storage"}
jqNoJMESPath expression to filter/transform the response. IMPORTANT: Always use this to extract only needed fields and reduce token costs. Examples: "results[*].{id: id, title: title}" (extract specific fields), "results[0]" (first result), "results[*].id" (IDs only). See https://jmespath.org
outputFormatNoOutput format: "toon" (default, 30-60% fewer tokens) or "json". TOON is optimized for LLMs with tabular arrays and minimal syntax.

Implementation Reference

  • Registers the 'conf_get' MCP tool with the server, providing title, description reference, input schema (GetApiToolArgs), and the 'get' handler function.
    server.registerTool(
    	'conf_get',
    	{
    		title: 'Confluence GET Request',
    		description: CONF_GET_DESCRIPTION,
    		inputSchema: GetApiToolArgs,
    	},
    	get,
    );
  • Zod schema definition for 'conf_get' tool input arguments: path (required), optional queryParams, jq filter, outputFormat. Base schema used by GetApiToolArgs.
    const BaseApiToolArgs = {
    	/**
    	 * The API endpoint path (without base URL)
    	 * Examples:
    	 * - "/wiki/api/v2/spaces" - list spaces
    	 * - "/wiki/api/v2/spaces/{id}" - get space
    	 * - "/wiki/api/v2/pages" - list/create pages
    	 * - "/wiki/api/v2/pages/{id}" - get page
    	 * - "/wiki/api/v2/pages/{id}/body" - get page body
    	 */
    	path: z
    		.string()
    		.min(1, 'Path is required')
    		.describe(
    			'The Confluence API endpoint path (without base URL). Must start with "/". Examples: "/wiki/api/v2/spaces", "/wiki/api/v2/pages", "/wiki/api/v2/pages/{id}"',
    		),
    
    	/**
    	 * Optional query parameters as key-value pairs
    	 */
    	queryParams: z
    		.record(z.string(), z.string())
    		.optional()
    		.describe(
    			'Optional query parameters as key-value pairs. Examples: {"limit": "25", "cursor": "...", "space-id": "123", "body-format": "storage"}',
    		),
    
    	/**
    	 * Optional JMESPath expression to filter/transform the response
    	 * IMPORTANT: Always use this to reduce response size and token costs
    	 */
    	jq: z
    		.string()
    		.optional()
    		.describe(
    			'JMESPath expression to filter/transform the response. IMPORTANT: Always use this to extract only needed fields and reduce token costs. Examples: "results[*].{id: id, title: title}" (extract specific fields), "results[0]" (first result), "results[*].id" (IDs only). See https://jmespath.org',
    		),
    
    	/**
    	 * Output format for the response
    	 * Defaults to TOON (token-efficient), can be set to JSON if needed
    	 */
    	outputFormat: OutputFormat,
    };
    
    /**
     * Body field for requests that include a request body (POST, PUT, PATCH)
     */
    const bodyField = z
    	.record(z.string(), z.unknown())
    	.describe(
    		'Request body as a JSON object. Structure depends on the endpoint. Example for page: {"spaceId": "123", "title": "Page Title", "body": {"representation": "storage", "value": "<p>Content</p>"}}',
    	);
    
    /**
     * Schema for conf_get tool arguments (GET requests - no body)
     */
    export const GetApiToolArgs = z.object(BaseApiToolArgs);
    export type GetApiToolArgsType = z.infer<typeof GetApiToolArgs>;
  • Factory function that creates the MCP-compatible handler for 'conf_get' (GET requests). Takes args, calls controller's handleGet, truncates output for AI, returns MCP content format or error.
    function createReadHandler(
    	methodName: string,
    	handler: (
    		options: GetApiToolArgsType,
    	) => Promise<{ content: string; rawResponsePath?: string | null }>,
    ) {
    	return async (args: Record<string, unknown>) => {
    		const methodLogger = Logger.forContext(
    			'tools/atlassian.api.tool.ts',
    			methodName.toLowerCase(),
    		);
    		methodLogger.debug(`Making ${methodName} request with args:`, args);
    
    		try {
    			const result = await handler(args as GetApiToolArgsType);
    
    			methodLogger.debug(
    				'Successfully retrieved response from controller',
    			);
    
    			return {
    				content: [
    					{
    						type: 'text' as const,
    						text: truncateForAI(
    							result.content,
    							result.rawResponsePath,
    						),
    					},
    				],
    			};
    		} catch (error) {
    			methodLogger.error(`Failed to make ${methodName} request`, error);
    			return formatErrorForMcpTool(error);
    		}
    	};
    }
  • Controller handler specifically for GET requests (used by conf_get tool). Delegates to shared handleRequest which performs API call, JQ filtering, and output formatting.
    export async function handleGet(
    	options: GetApiToolArgsType,
    ): Promise<ControllerResponse> {
    	return handleRequest('GET', options);
    }
  • Core helper function that executes the HTTP request via Atlassian API service, applies JMESPath (jq) filtering, converts to TOON/JSON format, and handles errors. Used by all conf_* tools including conf_get.
    async function handleRequest(
    	method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',
    	options: RequestWithBodyOptions,
    ): Promise<ControllerResponse> {
    	const methodLogger = logger.forMethod(`handle${method}`);
    
    	try {
    		methodLogger.debug(`Making ${method} request`, {
    			path: options.path,
    			...(options.body && { bodyKeys: Object.keys(options.body) }),
    		});
    
    		// Call the service layer (returns TransportResponse with data and rawResponsePath)
    		const response = await atlassianApiService.request<unknown>(
    			options.path,
    			{
    				method,
    				queryParams: options.queryParams,
    				body: options.body,
    			},
    		);
    
    		methodLogger.debug('Successfully received response from service');
    
    		// Apply JQ filter if provided, otherwise return raw data
    		const result = applyJqFilter(response.data, options.jq);
    
    		// Convert to output format (TOON by default, JSON if requested)
    		const useToon = options.outputFormat !== 'json';
    		const content = await toOutputString(result, useToon);
    
    		return {
    			content,
    			rawResponsePath: response.rawResponsePath,
    		};
    	} catch (error) {
    		throw handleControllerError(error, {
    			entityType: 'API',
    			operation: `${method} request`,
    			source: `controllers/atlassian.api.controller.ts@handle${method}`,
    			additionalInfo: { path: options.path },
    		});
    	}
    }
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It excels by detailing cost implications ('Unfiltered responses are very expensive!'), output format options (TOON vs. JSON with token efficiency notes), and practical usage patterns like schema discovery. It also warns about token costs and provides API reference context, going beyond basic functionality.

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 well-structured with clear sections (e.g., 'IMPORTANT - Cost Optimization', 'Schema Discovery Pattern'), but it is lengthy due to detailed examples and references. Every sentence adds value (e.g., cost tips, API paths), so it's not wasteful, though it could be more front-loaded by stating the core purpose more prominently before diving into details.

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 (4 parameters, no annotations, no output schema), the description is highly complete. It covers purpose, usage guidelines, behavioral traits (cost, output formats), parameter semantics with examples, and contextual info like common paths and API references. This compensates well for the lack of structured metadata, making it self-sufficient for an agent.

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 description coverage is 100%, so the baseline is 3. The description adds significant value by explaining the purpose and best practices for parameters: it emphasizes `jq` for cost reduction, provides examples for `path` and `queryParams`, and clarifies `outputFormat` implications (TOON's token efficiency). However, it doesn't add deep semantic nuances beyond what the schema hints at, such as advanced `jq` use cases.

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's purpose: 'Read any Confluence data.' It specifies the verb ('Read') and resource ('Confluence data'), distinguishing it from sibling tools like conf_delete, conf_patch, conf_post, and conf_put which imply write operations. However, it doesn't explicitly differentiate from other read-only tools if they exist, though the sibling list suggests this is the primary read tool.

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, including cost optimization tips (e.g., 'ALWAYS use `jq` param'), schema discovery patterns, and common paths for specific use cases like listing spaces or pages. It implicitly distinguishes from siblings by focusing on read operations, though it doesn't name alternatives directly since siblings are write operations.

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/aashari/mcp-server-atlassian-confluence'

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