Skip to main content
Glama
aaronsb

Confluence MCP Server

get_confluence_page

Retrieve Confluence page content in markdown format by specifying its ID. Access page metadata, version history, and space information for direct content management.

Instructions

Get a specific Confluence page by its ID. Returns the complete page content in markdown format, along with metadata like version history and space information. The page ID can be found in search results, page listings, or other API responses. TIP: Save page IDs from searches for direct access to frequently needed pages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageIdYesID of the page to retrieve

Implementation Reference

  • The main handler function that executes the get_confluence_page tool logic: fetches the page using ConfluenceClient, converts content to markdown, simplifies the response, and returns it as MCP content.
    export async function handleGetConfluencePage(
      client: ConfluenceClient,
      args: { pageId: string }
    ): Promise<{
      content: Array<{ type: "text"; text: string }>;
    }> {
      try {
        if (!args.pageId) {
          throw new McpError(ErrorCode.InvalidParams, "pageId is required");
        }
    
        try {
          const page = await client.getConfluencePage(args.pageId);
          
          if (!page.body?.storage?.value) {
            throw new McpError(
              ErrorCode.InternalError,
              "Page content is empty"
            );
          }
    
          const markdownContent = convertStorageToMarkdown(page.body.storage.value);
          const simplified = convertToSimplifiedPage(page, markdownContent);
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(simplified),
              },
            ],
          };
        } catch (error) {
          if (error instanceof ConfluenceError) {
            switch (error.code) {
              case 'PAGE_NOT_FOUND':
                throw new McpError(ErrorCode.InvalidParams, "Page not found");
              case 'INSUFFICIENT_PERMISSIONS':
                throw new McpError(ErrorCode.InvalidRequest, "Insufficient permissions to access page");
              case 'EMPTY_CONTENT':
                throw new McpError(ErrorCode.InternalError, "Page content is empty");
              default:
                throw new McpError(ErrorCode.InternalError, error.message);
            }
          }
          throw error;
        }
      } catch (error) {
        console.error("Error getting page:", error instanceof Error ? error.message : String(error));
        if (error instanceof McpError) {
          throw error;
        }
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get page: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • src/index.ts:214-218 (registration)
    Tool registration and dispatch in the main switch statement: handles the 'get_confluence_page' case by calling the handler function.
    case "get_confluence_page": {
      const { pageId } = (args || {}) as { pageId: string };
      if (!pageId) throw new McpError(ErrorCode.InvalidParams, "pageId is required");
      return await handleGetConfluencePage(this.confluenceClient, { pageId });
    }
  • Input schema and description for the get_confluence_page tool.
    get_confluence_page: {
      description: "Get a specific Confluence page by its ID. Returns the complete page content in markdown format, along with metadata like version history and space information. The page ID can be found in search results, page listings, or other API responses. TIP: Save page IDs from searches for direct access to frequently needed pages.",
      inputSchema: {
        type: "object",
        properties: {
          pageId: {
            type: "string",
            description: "ID of the page to retrieve",
          },
        },
        required: ["pageId"],
      },
    },
  • Core API client method that fetches Confluence page metadata and content, used by the handler.
    async getConfluencePage(pageId: string): Promise<Page> {
      try {
        // Get page metadata
        const pageResponse = await this.v2Client.get(`/pages/${pageId}`);
        const page = pageResponse.data;
    
        try {
          // Get page content
          const content = await this.getPageContent(pageId);
          return {
            ...page,
            body: {
              storage: {
                value: content,
                representation: 'storage'
              }
            }
          };
        } catch (contentError) {
          if (contentError instanceof ConfluenceError && 
              contentError.code === 'EMPTY_CONTENT') {
            return page; // Return metadata only for empty pages
          }
          throw contentError;
        }
      } catch (error) {
        if (axios.isAxiosError(error)) {
          console.error('Error fetching page:', error.message);
          throw error;
        }
        console.error('Error fetching page:', error instanceof Error ? error.message : 'Unknown error');
        throw new Error('Failed to fetch page content');
      }
    }
  • Helper function to convert full Page object and markdown content to simplified response format.
    function convertToSimplifiedPage(page: Page, markdownContent: string): SimplifiedPage {
      return {
        title: page.title,
        content: markdownContent,
        metadata: {
          id: page.id,
          spaceId: page.spaceId,
          version: page.version.number,
          lastModified: page.version.createdAt,
          url: page._links.webui
        }
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: it returns complete page content in markdown format and metadata like version history and space information. However, it lacks details on error handling (e.g., what happens if the page ID is invalid), rate limits, or authentication needs, leaving some gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by details on returns and usage tips. Every sentence adds value, such as specifying the output format and practical advice on saving page IDs, with no redundant or wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is mostly complete. It covers purpose, usage, and output details, but lacks information on error cases or system behavior, which would be helpful for full contextual understanding. However, it adequately addresses the core needs for a simple retrieval tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'pageId' fully documented in the schema. The description adds minimal value beyond the schema by explaining where to find the page ID (e.g., in search results or listings), but does not provide additional syntax or format details. This meets the baseline of 3 when the schema handles most of the parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get a specific Confluence page by its ID') and resource ('Confluence page'), distinguishing it from siblings like 'list_confluence_pages' (which lists multiple pages) and 'find_confluence_page' (which likely searches by criteria rather than direct ID). The verb 'Get' is precise and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use this tool: when you have a specific page ID from sources like search results or listings. It implicitly suggests alternatives by mentioning 'search results' and 'page listings,' which relate to sibling tools like 'search_confluence_pages' and 'list_confluence_pages,' but does not explicitly name them or state when not to use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/aaronsb/confluence-cloud-mcp'

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