get_page_content
Retrieve content from Confluence pages using page IDs to access stored documentation and information.
Instructions
Get the content of a Confluence page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageId | Yes | Confluence Page ID |
Implementation Reference
- src/index.ts:134-149 (handler)Core handler function that retrieves the content of a Confluence page by pageId using the REST API, including error handling.async function getPageContent(pageId: string): Promise<any> { try { const response = await axios.get( `${CONFLUENCE_URL}/wiki/rest/api/content/${pageId}?expand=body.storage,version`, { headers: getAuthHeaders().headers, }, ); return response.data; } catch (error: any) { return { error: error.response ? error.response.data : error.message, }; } }
- src/index.ts:59-72 (registration)Registers the 'get_page_content' tool in the listTools response, including name, description, and input schema.{ name: 'get_page_content', description: 'Get the content of a Confluence page', inputSchema: { type: 'object', properties: { pageId: { type: 'string', description: 'Confluence Page ID', }, }, required: ['pageId'], }, },
- src/index.ts:62-71 (schema)Defines the input schema for the get_page_content tool, requiring a pageId string.inputSchema: { type: 'object', properties: { pageId: { type: 'string', description: 'Confluence Page ID', }, }, required: ['pageId'], },
- src/index.ts:251-268 (handler)MCP CallToolRequest handler case for 'get_page_content': validates input, calls getPageContent, and formats response as text content.case 'get_page_content': { const pageId = String(request.params.arguments?.pageId); if (!pageId) { throw new Error('Page ID is required'); } const response = await getPageContent(pageId); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; }