Skip to main content
Glama
KS-GEN-AI

Confluence Communication Server

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
NameRequiredDescriptionDefault
pageIdYesConfluence Page ID

Implementation Reference

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

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/KS-GEN-AI/confluence-mcp-server'

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