update_page
Modify and refresh Confluence pages by updating their title, content, and version number through the MCP server, ensuring accurate and synchronized page revisions.
Instructions
Update an existing Confluence page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | New page content | |
| pageId | Yes | Page ID to update | |
| title | Yes | New page title | |
| version | Yes | Current version number (required for updates) |
Implementation Reference
- src/confluence-client.ts:248-280 (handler)Core implementation of page update logic: fetches current page for validation, constructs UpdatePageRequest, and performs PUT request to Confluence APIasync updatePage( pageId: string, title: string, content: string, version: number ): Promise<ConfluencePage> { const currentPage = await this.getPage(pageId); if (!currentPage.space || !currentPage.space.key) { throw new Error('Unable to determine page space for access validation'); } if (!validateSpaceAccess(currentPage.space.key, this.config.allowedSpaces)) { throw new Error(`Access denied to space: ${currentPage.space.key}`); } const updateData: UpdatePageRequest = { id: pageId, status: 'current', title, type: 'page', version: { number: version }, body: { storage: { value: content, representation: 'storage' } } }; const response: AxiosResponse<ConfluencePage> = await this.client.put(`/pages/${pageId}`, updateData); return response.data; }
- src/index.ts:337-354 (handler)MCP server tool handler for 'update_page': extracts parameters from request and calls ConfluenceClient.updatePagecase 'update_page': { const { pageId, title, content, version } = args as { pageId: string; title: string; content: string; version: number; }; const page = await confluenceClient.updatePage(pageId, title, content, version); return { content: [ { type: 'text', text: JSON.stringify(page, null, 2) } ] }; }
- src/index.ts:115-139 (registration)Tool registration in ListTools handler, including name, description, and input schemaname: 'update_page', description: 'Update an existing Confluence page', inputSchema: { type: 'object', properties: { pageId: { type: 'string', description: 'Page ID to update' }, title: { type: 'string', description: 'New page title' }, content: { type: 'string', description: 'New page content' }, version: { type: 'number', description: 'Current version number (required for updates)' } }, required: ['pageId', 'title', 'content', 'version'] } },
- src/types.ts:76-90 (schema)TypeScript interface defining the structure of data sent to Confluence update APIexport interface UpdatePageRequest { id: string; status: string; title: string; type: string; version: { number: number; }; body: { storage: { value: string; representation: string; }; }; }