Skip to main content
Glama
Olson3R
by Olson3R

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
NameRequiredDescriptionDefault
bodyFormatNoBody format to include: "storage" or "view" (optional)
pageIdYesConfluence page ID

Implementation Reference

  • 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']
      }
    },
  • 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']
    }
  • 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;
    }
Install Server

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