Skip to main content
Glama
akhilthomas236

MCP Jira & Confluence Server

get-confluence-page

Retrieve a Confluence page's content by page ID or title and space key. Optionally include comments and version history.

Instructions

Get a Confluence page by ID or title. Use this tool to retrieve a specific page's content, optionally including comments and version history.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idNoThe ID of the Confluence page
titleNoThe title of the Confluence page
space_keyNoThe key of the Confluence space
include_commentsNo
include_historyNo

Implementation Reference

  • Tool registration for 'get-confluence-page' in handle_list_tools(). Defines the tool name, description, and input schema (JSON Schema) with parameters: page_id, title, space_key, include_comments, include_history. Uses anyOf to require either page_id or (title + space_key).
    types.Tool(
        name="get-confluence-page",
        description="Get a Confluence page by ID or title. Use this tool to retrieve a specific page's content, optionally including comments and version history.",
        inputSchema={
            "type": "object",
            "properties": {
                "page_id": {"type": "string", "description": "The ID of the Confluence page"},
                "title": {"type": "string", "description": "The title of the Confluence page"},
                "space_key": {"type": "string", "description": "The key of the Confluence space"},
                "include_comments": {"type": "boolean", "default": False},
                "include_history": {"type": "boolean", "default": False}
            },
            "anyOf": [
                {"required": ["page_id"]},
                {"required": ["title", "space_key"]}
            ]
        }
    ),
  • Handler implementation for 'get-confluence-page' in handle_call_tool(). Fetches a Confluence page by ID or title+space_key, retrieves body.storage content, version, and space info. Optionally includes comments (via confluence_client.get_page_comments) and version history (via confluence_client.get_page_history). Returns formatted markdown content.
    elif name == "get-confluence-page":
        page_id = arguments.get("page_id")
        title = arguments.get("title")
        space_key = arguments.get("space_key")
        include_comments = arguments.get("include_comments", False)
        include_history = arguments.get("include_history", False)
        
        if not page_id and (not title or not space_key):
            raise ValueError("Missing required arguments: either page_id or both title and space_key")
            
        # Fetch the page data
        page_data = None
        if page_id:
            page_data = await confluence_client.get_page(page_id, expand="body.storage,version,space")
        else:
            # Search by title and space key
            cql = f'title = "{title}" AND space.key = "{space_key}"'
            search_result = await confluence_client.search(cql, limit=1)
            if search_result.get("results"):
                page_id = search_result["results"][0]["id"]
                page_data = await confluence_client.get_page(page_id, expand="body.storage,version,space")
            else:
                raise ValueError("Page not found")
        
        # Format the response
        title = page_data["title"]
        content = page_data["body"]["storage"]["value"]
        space_name = page_data.get("space", {}).get("name", "Unknown Space")
        version = page_data["version"]["number"] if "version" in page_data else "Unknown"
        
        response = f"**Title:** {title}\n"
        response += f"**Space:** {space_name}\n"
        response += f"**Version:** {version}\n\n"
        response += f"{ConfluenceFormatter.confluence_to_markdown(content)}"
        
        if include_comments:
            # Add comments section
            try:
                comments_data = await confluence_client.get_page_comments(page_id)
                if comments_data.get("results"):
                    response += "\n\n**Comments:**\n"
                    for comment in comments_data["results"]:
                        author = comment.get("by", {}).get("displayName", "Unknown")
                        body = comment.get("body", {}).get("storage", {}).get("value", "")
                        created = comment.get("when", "")
                        
                        response += f"- **{author}** on {created}: {ConfluenceFormatter.confluence_to_markdown(body)}\n"
            except Exception as e:
                logger.warning(f"Could not fetch comments: {e}")
        
        if include_history:
            # Add history section
            try:
                history_data = await confluence_client.get_page_history(page_id)
                if history_data.get("results"):
                    response += "\n\n**History:**\n"
                    for version_info in history_data["results"]:
                        version_number = version_info.get("number", "Unknown")
                        author = version_info.get("by", {}).get("displayName", "Unknown")
                        date = version_info.get("when", "Unknown")
                        
                        response += f"- Version {version_number} by {author} on {date}\n"
            except Exception as e:
                logger.warning(f"Could not fetch history: {e}")
        
        return [
            types.TextContent(
                type="text",
                text=response,
            )
        ]
  • ConfluenceClient.get_page() - the low-level API call that retrieves a Confluence page by ID with optional expand parameters. Used by the handler to fetch page content.
    async def get_page(self, page_id: str, expand: Optional[str] = None) -> Dict[str, Any]:
        """Get a Confluence page by its ID."""
        params = {}
        if expand:
            params["expand"] = expand
        return await self.get(f"content/{page_id}", params=params)
    
    async def get_page_by_title(self, space_key: str, title: str) -> Optional[Dict[str, Any]]:
        """Get a page by its title in a specific space."""
        params = {
            "title": title,
            "spaceKey": space_key,
            "expand": "body.storage",
            "limit": 1
        }
        result = await self.get("content", params=params)
        
        if result.get("results") and len(result["results"]) > 0:
            return result["results"][0]
        return None
    
    async def create_page(self, space_key: str, title: str, content: str, parent_id: Optional[str] = None) -> Dict[str, Any]:
        """Create a new Confluence page."""
        data = {
            "type": "page",
            "title": title,
            "space": {"key": space_key},
            "body": {
                "storage": {
                    "value": content,
                    "representation": "storage"
                }
            }
        }
        
        if parent_id:
            data["ancestors"] = [{"id": parent_id}]
            
        return await self.post("content", data)
    
    async def update_page(self, page_id: str, title: str, content: str, version: int) -> Dict[str, Any]:
        """Update an existing Confluence page."""
        data = {
            "type": "page",
            "title": title,
            "body": {
                "storage": {
                    "value": content,
                    "representation": "storage"
                }
            },
            "version": {
                "number": version + 1
            }
        }
        
        return await self.put(f"content/{page_id}", data)
    
    async def add_comment(self, page_id: str, comment: str) -> Dict[str, Any]:
        """Add a comment to a Confluence page."""
        data = {
            "type": "comment",
            "container": {"id": page_id, "type": "page"},
            "body": {
                "storage": {
                    "value": comment,
                    "representation": "storage"
                }
            }
        }
        
        return await self.post("content", data)
    
    async def get_comments(self, page_id: str, start: int = 0, limit: int = 25) -> Dict[str, Any]:
        """Get comments for a Confluence page."""
        params = {
            "start": start,
            "limit": limit,
            "expand": "body.storage"
        }
        return await self.get(f"content/{page_id}/child/comment", params=params)
    
    async def get_page_comments(self, page_id: str) -> Dict[str, Any]:
        """Get comments for a Confluence page (alias for get_comments)."""
        return await self.get_comments(page_id)
    
    async def get_page_history(self, page_id: str) -> Dict[str, Any]:
        """Get version history for a Confluence page."""
        return await self.get(f"content/{page_id}/version", params={"expand": "by"})
  • ConfluenceClient.get_page_comments() - retrieves comments for a Confluence page, used when include_comments=True.
    async def get_comments(self, page_id: str, start: int = 0, limit: int = 25) -> Dict[str, Any]:
        """Get comments for a Confluence page."""
        params = {
            "start": start,
            "limit": limit,
            "expand": "body.storage"
        }
        return await self.get(f"content/{page_id}/child/comment", params=params)
    
    async def get_page_comments(self, page_id: str) -> Dict[str, Any]:
        """Get comments for a Confluence page (alias for get_comments)."""
        return await self.get_comments(page_id)
  • ConfluenceClient.get_page_history() - retrieves version history for a Confluence page, used when include_history=True.
    async def get_page_history(self, page_id: str) -> Dict[str, Any]:
        """Get version history for a Confluence page."""
        return await self.get(f"content/{page_id}/version", params={"expand": "by"})
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 indicates the tool is a read operation (Get), but does not disclose error behavior, permissions, or side effects. It is adequate but lacks depth.

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 two concise sentences, 24 words, front-loaded with the action, and contains no redundant information. It is efficient and well-structured.

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

Completeness3/5

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

For a simple retrieval tool with 5 parameters and no output schema, the description covers the core purpose and optional features but omits details about the return format and error handling, leaving some gaps.

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

Parameters4/5

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

The description adds meaning beyond the input schema by explaining the two identification methods (ID or title) and optional inclusion of comments and history. It effectively supplements the schema with a 60% coverage.

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 tool retrieves a Confluence page by ID or title, and distinguishes it from sibling tools like create, update, comment, or search. Its purpose is explicit and differentiated.

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

Usage Guidelines3/5

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

The description advises using this tool to retrieve a specific page's content, implying when to use it, but does not explicitly mention when not to use it or alternative tools like search-confluence or ask-confluence-page.

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/akhilthomas236/mcp-jira-confluence-sse'

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