Confluence POST Request
conf_postCreate pages, blog posts, comments, and labels in Atlassian Confluence using API endpoints to add content to your knowledge base.
Instructions
Create Confluence resources. Returns TOON format by default (token-efficient).
IMPORTANT - Cost Optimization:
Use
jqparam 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:
Create page:
/wiki/api/v2/pagesbody:{"spaceId": "123456", "status": "current", "title": "Page Title", "parentId": "789", "body": {"representation": "storage", "value": "<p>Content</p>"}}Create blog post:
/wiki/api/v2/blogpostsbody:{"spaceId": "123456", "status": "current", "title": "Blog Title", "body": {"representation": "storage", "value": "<p>Content</p>"}}Add label:
/wiki/api/v2/pages/{id}/labels- body:{"name": "label-name"}Add comment:
/wiki/api/v2/pages/{id}/footer-comments
API reference: https://developer.atlassian.com/cloud/confluence/rest/v2/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 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}" | |
| queryParams | No | Optional query parameters as key-value pairs. Examples: {"limit": "25", "cursor": "...", "space-id": "123", "body-format": "storage"} | |
| jq | No | 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 | |
| outputFormat | No | Output format: "toon" (default, 30-60% fewer tokens) or "json". TOON is optimized for LLMs with tabular arrays and minimal syntax. | |
| body | Yes | 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>"}} |
Implementation Reference
- src/tools/atlassian.api.tool.ts:248-256 (registration)Registers the 'conf_post' MCP tool with title, description, input schema (RequestWithBodyArgs), and the 'post' handler function.
server.registerTool( 'conf_post', { title: 'Confluence POST Request', description: CONF_POST_DESCRIPTION, inputSchema: RequestWithBodyArgs, }, post, ); - Zod schema definition for input arguments to conf_post (and other write tools), including path, queryParams, jq, outputFormat, and body.
export const RequestWithBodyArgs = z.object({ ...BaseApiToolArgs, body: bodyField, }); export type RequestWithBodyArgsType = z.infer<typeof RequestWithBodyArgs>; - The handlePost function, which is passed to the tool handler creator and executes the POST-specific logic by calling the generic handleRequest.
export async function handlePost( options: RequestWithBodyArgsType, ): Promise<ControllerResponse> { return handleRequest('POST', options); } - src/tools/atlassian.api.tool.ts:78-117 (handler)createWriteHandler creates the actual MCP tool executor function for POST/PUT/PATCH tools like conf_post. It logs args, calls the controller handler, truncates response for AI, handles errors, and formats MCP content response.
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); } }; } - src/index.ts:65-65 (registration)Top-level call to register all Atlassian API tools, including conf_post, during MCP server initialization.
atlassianApiTools.registerTools(serverInstance);