get_page
Retrieve a specific Confluence page by its ID with optional body formats using Confluence MCP Server to access and manage content programmatically.
Instructions
Retrieve a specific Confluence page by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bodyFormat | No | Body format to include: "storage" or "view" (optional) | |
| pageId | Yes | Confluence page ID |
Implementation Reference
- src/index.ts:301-316 (handler)MCP tool handler for 'get_page': destructures input arguments, invokes ConfluenceClient.getPage method, serializes the result as JSON, and returns it as text content in the MCP response format.case 'get_page': { const { pageId, bodyFormat } = args as { pageId: string; bodyFormat?: string; }; const page = await confluenceClient.getPage(pageId, bodyFormat); return { content: [ { type: 'text', text: JSON.stringify(page, null, 2) } ] }; }
- src/index.ts:69-87 (registration)Tool registration in ListToolsResponse: defines name 'get_page', description, and inputSchema specifying required pageId and optional bodyFormat.{ name: 'get_page', description: 'Retrieve a specific Confluence page by ID', inputSchema: { type: 'object', properties: { pageId: { type: 'string', description: 'Confluence page ID' }, bodyFormat: { type: 'string', description: 'Body format to include: "storage" or "view" (optional)', enum: ['storage', 'view'] } }, required: ['pageId'] } },
- src/index.ts:72-86 (schema)JSON schema for 'get_page' tool input validation: requires pageId string, optional bodyFormat enum.inputSchema: { type: 'object', properties: { pageId: { type: 'string', description: 'Confluence page ID' }, bodyFormat: { type: 'string', description: 'Body format to include: "storage" or "view" (optional)', enum: ['storage', 'view'] } }, required: ['pageId'] }
- src/confluence-client.ts:182-212 (helper)ConfluenceClient.getPage helper method: performs authenticated GET to Confluence v1 API content endpoint with space/version/body expansion, validates allowed space access, returns ConfluencePage.async getPage(pageId: string, bodyFormat?: string): Promise<ConfluencePage> { // Use v1 API for getPage since we need space information anyway let expandParam = 'space,version'; if (bodyFormat) { const format = bodyFormat === 'view' ? 'body.view' : 'body.storage'; expandParam += `,${format}`; } const v1Url = `${this.config.baseUrl}/wiki/rest/api/content/${pageId}?expand=${expandParam}`; const auth = Buffer.from(`${this.config.username}:${this.config.apiToken}`).toString('base64'); const response = await axios.get(v1Url, { headers: { 'Authorization': `Basic ${auth}`, 'Accept': 'application/json', 'Content-Type': 'application/json' }, timeout: 30000 }); // Validate space access if (!response.data.space || !response.data.space.key) { throw new Error('Unable to determine page space for access validation'); } if (!validateSpaceAccess(response.data.space.key, this.config.allowedSpaces)) { throw new Error(`Access denied to space: ${response.data.space.key}`); } return response.data; }