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:
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