Skip to main content
Glama

get_page_children

Retrieve child pages of a specific Confluence page using its ID, with options for pagination, result limits, and body format output.

Instructions

Get child pages of a specific page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyFormatNoBody format to include: "storage" or "view" (optional)
limitNoMaximum results (default: 25)
pageIdYesParent page ID
startNoStarting index for pagination (default: 0)

Implementation Reference

  • Core handler function that implements the logic to fetch child pages of a given page ID from Confluence API v2, validates space access, and optionally enhances results with body content from v1 API.
    async getPageChildren(pageId: string, limit = 25, start = 0, bodyFormat?: string): Promise<PaginatedResult<ConfluencePage>> { const parentPage = await this.getPage(pageId); if (!parentPage.space || !parentPage.space.key) { throw new Error('Unable to determine page space for access validation'); } if (!validateSpaceAccess(parentPage.space.key, this.config.allowedSpaces)) { throw new Error(`Access denied to space: ${parentPage.space.key}`); } // Get basic children list from v2 API const response: AxiosResponse<PaginatedResult<ConfluencePage>> = await this.client.get(`/pages/${pageId}/children`, { params: { limit, start } }); // If body content is requested, enhance each page with body content from v1 API if (bodyFormat && response.data.results.length > 0) { const format = bodyFormat === 'view' ? 'body.view' : 'body.storage'; const auth = Buffer.from(`${this.config.username}:${this.config.apiToken}`).toString('base64'); const enhancedResults = await Promise.all( response.data.results.map(async (page) => { try { const v1Url = `${this.config.baseUrl}/wiki/rest/api/content/${page.id}?expand=${format},version,space`; const v1Response = await axios.get(v1Url, { headers: { 'Authorization': `Basic ${auth}`, 'Accept': 'application/json', 'Content-Type': 'application/json' }, timeout: 30000 }); if (v1Response.data.body) { page.body = v1Response.data.body; } } catch (error) { if (this.config.debug) { console.warn(`Failed to retrieve body content for page ${page.id}:`, error); } } return page; }) ); response.data.results = enhancedResults; } return response.data; }
  • MCP server tool call handler for 'get_page_children' that extracts parameters from the request and delegates execution to ConfluenceClient.getPageChildren, returning JSON-formatted results.
    case 'get_page_children': { const { pageId, limit = 25, start = 0, bodyFormat } = args as { pageId: string; limit?: number; start?: number; bodyFormat?: string; }; const children = await confluenceClient.getPageChildren(pageId, limit, start, bodyFormat); return { content: [ { type: 'text', text: JSON.stringify(children, null, 2) } ] }; }
  • src/index.ts:237-265 (registration)
    Tool registration in the MCP server's listTools handler, defining the name, description, and input schema for the 'get_page_children' tool.
    { name: 'get_page_children', description: 'Get child pages of a specific page', inputSchema: { type: 'object', properties: { pageId: { type: 'string', description: 'Parent page ID' }, limit: { type: 'number', description: 'Maximum results (default: 25)', default: 25 }, start: { type: 'number', description: 'Starting index for pagination (default: 0)', default: 0 }, bodyFormat: { type: 'string', description: 'Body format to include: "storage" or "view" (optional)', enum: ['storage', 'view'] } }, required: ['pageId'] } }

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/Olson3R/confluence-mcp'

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