Skip to main content
Glama

cwiki_get_page

Fetch a wiki page by title or page ID. Choose between plain, view, or storage format and optionally force a refresh of cached content.

Instructions

Fetch a wiki page by page title or page id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNo
page_idNo
formatNoplain
force_refreshNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the cwiki_get_page tool. It fetches a Confluence wiki page by title or page_id, retrieves its content in the requested format (plain, view, or storage), and returns a dict with page summary, ancestors, and content.
    @mcp.tool()
    def cwiki_get_page(
        title: str | None = None,
        page_id: str | None = None,
        format: Literal["plain", "view", "storage"] = "plain",
        force_refresh: bool = False,
    ) -> dict[str, Any]:
        """Fetch a wiki page by page title or page id."""
        if not title and not page_id:
            raise ValueError("Provide either title or page_id.")
    
        page = (
            client.get_page_by_id(page_id, force_refresh=force_refresh)
            if page_id
            else client.get_page_by_title(title or "", force_refresh=force_refresh)
        )
    
        return {
            **client.page_summary(page),
            "ancestors": [
                {"id": ancestor.get("id"), "title": ancestor.get("title")}
                for ancestor in page.get("ancestors", [])
            ],
            "contentFormat": format,
            "content": page_content(page, format),
        }
  • Helper function page_content() called by cwiki_get_page to extract body content in storage, view, or plain (HTML-to-text) format.
    def page_content(page: dict[str, Any], format: Literal["plain", "view", "storage"]) -> str:
        body = page.get("body", {})
        if format == "storage":
            return body.get("storage", {}).get("value", "")
    
        view = body.get("view", {}).get("value") or body.get("storage", {}).get("value", "")
        return html_to_text(view) if format == "plain" else view
  • The @mcp.tool() decorator on line 87 registers cwiki_get_page as an MCP tool with the FastMCP server.
    @mcp.tool()
    def cwiki_get_page(
  • Helper client.get_page_by_id() called by the handler when page_id is provided.
    def get_page_by_id(page_id: str | None, *, force_refresh: bool = False) -> dict[str, Any]:
        if not page_id:
            raise ValueError("page_id must not be empty")
        return confluence_get(
            f"/rest/api/content/{urllib.parse.quote(page_id)}",
            {"expand": "body.storage,body.view,version,history,ancestors,space"},
            force_refresh=force_refresh,
        )
  • Helper client.get_page_by_title() called by the handler when title is provided.
    def get_page_by_title(title: str, *, force_refresh: bool = False) -> dict[str, Any]:
        if not title.strip():
            raise ValueError("title must not be empty")
    
        pages = confluence_get(
            "/rest/api/content",
            {
                "spaceKey": SPACE_KEY,
                "title": title,
                "type": "page",
                "status": "current",
                "limit": "2",
                "expand": "body.storage,body.view,version,history,ancestors,space",
            },
            force_refresh=force_refresh,
        )
        results = pages.get("results", [])
        if not results:
            raise ValueError(f'No page found with title "{title}" in space {SPACE_KEY}.')
        if len(results) > 1:
            raise ValueError(f'More than one page matched title "{title}". Use page_id instead.')
        return results[0]
Behavior2/5

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

No annotations are provided, so the description carries full responsibility. It does not disclose behavior like caching, error handling, or what happens if both title and page_id are provided. The force_refresh parameter is not explained.

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 a single sentence, which is concise, but at the cost of omitting important details. It could include more information without being overly verbose.

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?

Given the tool has 4 parameters and an output schema, the description is too minimal. It does not explain the format parameter, force_refresh, or how the identifiers relate, leaving the agent with insufficient context for correct invocation.

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

Parameters1/5

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

Schema description coverage is 0%, yet the description adds no meaning beyond the parameter names. It does not explain the format enum, the force_refresh boolean, or the mutual exclusivity of title and page_id.

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 verb 'Fetch' and the resource 'wiki page', and specifies the two identifiers (title or page id). This distinguishes it from sibling tools like cwiki_get_children (gets children) and cwiki_search_pages (searches).

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?

No guidelines on when to use this tool vs alternatives. There is no mention of prerequisites, when to prefer this over other page-related tools, or any exclusions.

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/justinmclean/CwikiMCP'

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