Skip to main content
Glama
xiandan-erizo

Confluence MCP Server

get_confluence_page

Retrieve detailed content from Confluence pages by providing a page ID to access documentation and information stored in Confluence systems.

Instructions

    获取 Confluence 页面详细信息

    Args:
        page_id: 页面ID
        ctx: MCP 上下文

    Returns:
        Dict: 包含页面信息的字典
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idYes

Implementation Reference

  • The main MCP tool handler for get_confluence_page. This async function is decorated with @mcp.tool() and handles the request, including logging, error handling, and calling the underlying confluence utility to fetch page content.
    @mcp.tool()
    async def get_confluence_page(
        ctx: Context,
        page_id: Union[int, str],
    ) -> Dict:
        """
        获取 Confluence 页面详细信息
    
        Args:
            page_id: 页面ID
            ctx: MCP 上下文
    
        Returns:
            Dict: 包含页面信息的字典
        """
        try:
            await ctx.session.send_log_message(
                level="info",
                data=f"获取页面内容: page_id='{page_id}'"
            )
    
            page_info = confluence.get_page_content(page_id)
            if not page_info:
                raise ValueError(f"未找到页面: {page_id}")
            return {
                "success": True,
                "page": page_info
            }
    
        except Exception as e:
            error_msg = f"获取页面失败: {str(e)}"
            await ctx.session.send_log_message(
                level="error",
                data=error_msg
            )
            return {
                "success": False,
                "error": error_msg
            }
  • The core implementation logic that fetches page content from Confluence API. The get_page_content method uses the atlassian.Confluence client to retrieve page details with expanded fields including body, version, space, history, and labels.
    def get_page_content(self, page_id):
        """
        获取页面的完整信息
        :param page_id: 页面 ID
        :return: 包含页面详细信息的字典
        """
        
        page = self.confluence.get_page_by_id(
            page_id, 
            expand='body.storage,version,space,history,metadata.labels'
        )
        
        if not page:
            return None
            
        # 构建完整的页面信息
        page_info = {
            'id': page.get('id'),
            'title': page.get('title'),
            'space': {
                'key': page.get('space', {}).get('key'),
                'name': page.get('space', {}).get('name')
            },
            'version': page.get('version', {}).get('number'),
            'content': page.get('body', {}).get('storage', {}).get('value'),
            'url': self.page_url.format(page_id=page_id),
            'created': {
                'date': page.get('history', {}).get('createdDate'),
                'by': page.get('history', {}).get('createdBy', {}).get('displayName')
            },
            'modified': {
                'date': page.get('version', {}).get('when'),
                'by': page.get('version', {}).get('by', {}).get('displayName')
            },
            'labels': [label.get('name') for label in page.get('metadata', {}).get('labels', {}).get('results', [])]
        }
        
        return page_info
  • Tool registration using the @mcp.tool() decorator, which registers get_confluence_page as an available MCP tool with its signature and parameters.
    @mcp.tool()
    async def get_confluence_page(
        ctx: Context,
        page_id: Union[int, str],
    ) -> Dict:
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While '获取' (get) implies a read operation, the description doesn't address authentication requirements, rate limits, error conditions, or what happens with invalid page IDs. It mentions returning a dictionary but provides no details about its structure or content.

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

Conciseness3/5

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

The description is reasonably concise with three brief sections, but the structure is somewhat inefficient. The 'Args' and 'Returns' sections use valuable space to state what's already evident from the parameter names and return type declaration, rather than providing meaningful additional information.

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

Completeness2/5

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

For a tool with no annotations, no output schema, and 0% schema description coverage, the description is inadequate. It doesn't explain what information the returned dictionary contains, how to handle different page ID formats, authentication requirements, or error scenarios. The agent would struggle to use this tool effectively without trial and error.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'page_id: 页面ID' (page ID) and 'ctx: MCP 上下文' (MCP context), but provides no meaningful semantic information about what constitutes a valid page ID, format expectations, or how the context parameter should be used. The description adds minimal value beyond what's obvious from parameter names.

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

Purpose4/5

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

The description clearly states the tool's purpose as '获取 Confluence 页面详细信息' (Get Confluence page details), which is a specific verb+resource combination. However, it doesn't explicitly differentiate from its sibling tool 'search_confluence', which likely searches for pages rather than retrieving details of a specific page.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. There's no mention of when to use 'get_confluence_page' versus 'search_confluence', nor any context about prerequisites or appropriate use cases. The agent must infer usage from the tool name alone.

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/xiandan-erizo/ops-mcp'

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