Skip to main content
Glama
aashari

Atlassian Confluence MCP Server

by aashari

Confluence POST Request

conf_post

Create Confluence pages, blog posts, labels, and comments via API. Specify the endpoint path, query parameters, and request body to add content to your Confluence spaces.

Instructions

Create Confluence resources. Returns TOON format by default (token-efficient).

IMPORTANT - Cost Optimization:

  • Use jq param to extract only needed fields from response (e.g., jq: "{id: id, title: title}")

  • Unfiltered responses include all metadata and are expensive!

Output format: TOON (default) or JSON (outputFormat: "json")

Common operations:

  1. Create page: /wiki/api/v2/pages body: {"spaceId": "123456", "status": "current", "title": "Page Title", "parentId": "789", "body": {"representation": "storage", "value": "<p>Content</p>"}}

  2. Create blog post: /wiki/api/v2/blogposts body: {"spaceId": "123456", "status": "current", "title": "Blog Title", "body": {"representation": "storage", "value": "<p>Content</p>"}}

  3. Add label: /wiki/api/v2/pages/{id}/labels - body: {"name": "label-name"}

  4. Add comment: /wiki/api/v2/pages/{id}/footer-comments

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.
bodyYesRequest 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>"}}

Implementation Reference

  • The handlePost function is the actual handler that executes the conf_post tool logic. It calls the shared handleRequest function with 'POST' method, which calls the Atlassian API service and applies JQ filtering and output formatting.
    export async function handlePost(
    	options: RequestWithBodyArgsType,
    ): Promise<ControllerResponse> {
    	return handleRequest('POST', options);
    }
  • The conf_post tool is registered with the MCP server using server.registerTool() with name 'conf_post', description CONF_POST_DESCRIPTION, inputSchema RequestWithBodyArgs, and the 'post' handler (which wraps handlePost).
    // Register the POST tool using modern registerTool API
    server.registerTool(
    	'conf_post',
    	{
    		title: 'Confluence POST Request',
    		description: CONF_POST_DESCRIPTION,
    		inputSchema: RequestWithBodyArgs,
    	},
    	post,
    );
  • The input schema for conf_post is RequestWithBodyArgs, a Zod schema extending BaseApiToolArgs with a 'body' field (a JSON record) for POST request bodies.
    export const RequestWithBodyArgs = z.object({
    	...BaseApiToolArgs,
    	body: bodyField,
    });
  • The createWriteHandler function wraps the controller's handlePost into an MCP tool handler. It handles formatting the response and error formatting for the tool output.
    function createWriteHandler(
    	methodName: string,
    	handler: (
    		options: RequestWithBodyArgsType,
    	) => 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:`, {
    			path: args.path,
    			bodyKeys: args.body ? Object.keys(args.body as object) : [],
    		});
    
    		try {
    			const result = await handler(args as RequestWithBodyArgsType);
    
    			methodLogger.debug(
    				'Successfully received 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);
    		}
    	};
    }
  • The shared handleRequest function handles all HTTP methods (GET, POST, PUT, PATCH, DELETE). For POST, it calls atlassianApiService.request with method 'POST', then applies JQ filtering and converts output to TOON or JSON format.
    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 },
    		});
    	}
    }
Behavior3/5

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

No annotations; description covers output format and cost implications but lacks details on authentication requirements, potential side effects, or behavior for existing resources.

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?

Well-structured with sections and front-loaded important info, but slightly verbose with repeated examples.

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

Completeness4/5

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

Covers usage, cost optimization, output format, and common operations; missing auth and error handling, but references external documentation.

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

Parameters5/5

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

Schema coverage is 100% with descriptions. The description adds significant value with endpoint examples, body structures, and jq usage guidance beyond the schema.

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 tool creates Confluence resources, with specific examples like creating pages, blog posts, labels, and comments. This distinguishes it from sibling tools (get, delete, patch, put).

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?

Provides cost optimization tips and common operation examples, but does not explicitly state when not to use the tool or compare with siblings beyond implied HTTP methods.

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