Skip to main content
Glama
KS-GEN-AI

Confluence Communication Server

update_page_content

Modify Confluence page content by updating HTML and optionally changing the title using the page ID. Simplify content management within Confluence workspaces.

Instructions

Update the content of a Confluence page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesHTML content to update the page with
pageIdYesConfluence Page ID
titleNoPage title (optional, if you want to change it)

Implementation Reference

  • The core handler function implementing the update_page_content tool logic. Fetches current page details, increments version, constructs update payload with new content and optional title, and performs a PUT request to the Confluence REST API.
    async function updatePageContent( pageId: string, content: string, title?: string, ): Promise<any> { try { // First, get the current page to retrieve its version and other details const currentPage = await getPageContent(pageId); if (currentPage.error) { return { error: `Failed to get current page: ${currentPage.error}`, }; } // Create update payload const updatePayload = { id: pageId, type: currentPage.type, title: title || currentPage.title, space: currentPage.space, body: { storage: { value: content, representation: 'storage', }, }, version: { number: currentPage.version.number + 1, }, }; // Update the page const response = await axios.put( `${CONFLUENCE_URL}/wiki/rest/api/content/${pageId}`, updatePayload, { headers: { ...getAuthHeaders().headers, 'Content-Type': 'application/json', }, }, ); return response.data; } catch (error: any) { return { error: error.response ? error.response.data : error.message, }; } }
  • The input schema definition for the update_page_content tool, specifying required pageId and content, optional title, used in the ListTools response.
    name: 'update_page_content', description: 'Update the content of a Confluence page', inputSchema: { type: 'object', properties: { pageId: { type: 'string', description: 'Confluence Page ID', }, content: { type: 'string', description: 'HTML content to update the page with', }, title: { type: 'string', description: 'Page title (optional, if you want to change it)', }, }, required: ['pageId', 'content'], },
  • src/index.ts:270-294 (registration)
    The registration and dispatching logic in the CallToolRequestHandler switch statement, which validates arguments, calls the updatePageContent handler, and formats the response.
    case 'update_page_content': { const pageId = String(request.params.arguments?.pageId); const content = String(request.params.arguments?.content); const title = request.params.arguments?.title ? String(request.params.arguments?.title) : undefined; if (!pageId) { throw new Error('Page ID is required'); } if (!content) { throw new Error('Content is required'); } const response = await updatePageContent(pageId, content, title); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; }

Other Tools

Related 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/KS-GEN-AI/confluence-mcp-server'

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