Skip to main content
Glama

get_page

Retrieve the full markdown content of a Confluence page by its ID, exact title, or title substring, with optional section filtering.

Instructions

Return the full markdown of a page.

Args: page_ref: Confluence page id, exact title, or substring of the title. section: Optional heading text. If provided, only the matching section (and its sub-sections) is returned.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_refYes
sectionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_page'. Accepts page_ref (Confluence id, exact title, or substring) and optional section heading. Looks up the page via db.find_page_by_slug_or_title, then optionally slices to a heading section via _slice_section.
    @mcp.tool()
    def get_page(page_ref: str, section: str | None = None) -> str:
        """Return the full markdown of a page.
    
        Args:
            page_ref: Confluence page id, exact title, or substring of the title.
            section: Optional heading text. If provided, only the matching section
                     (and its sub-sections) is returned.
        """
        with closing(_conn()) as conn:
            row = db.find_page_by_slug_or_title(conn, page_ref)
        if not row:
            return f"No page found for {page_ref!r}."
        header = (
            f"# {row['title']}\n\n"
            f"_Breadcrumb:_ {row['breadcrumb']}\n"
            f"_URL:_ {row['url']}\n"
            f"_Page id:_ {row['id']}\n\n---\n\n"
        )
        body = row["body_md"]
        if section:
            body = _slice_section(body, section)
            if not body:
                return header + f"_(section {section!r} not found in page)_"
        return header + body
  • The @mcp.tool() decorator registers get_page as an MCP tool on the FastMCP server instance (line 34: mcp = FastMCP('of-mcp')).
    @mcp.tool()
    def get_page(page_ref: str, section: str | None = None) -> str:
  • Helper function _slice_section used by get_page to extract a single heading section (and its sub-sections) from the markdown body, based on case-insensitive heading text matching.
    def _slice_section(body_md: str, section: str) -> str:
        """Return the heading whose text contains `section` (case-insensitive),
        plus everything until the next heading of equal or higher level.
        """
        import re
    
        needle = section.strip().lower()
        lines = body_md.splitlines()
        start = -1
        start_level = 0
        for i, line in enumerate(lines):
            m = re.match(r"^(#{1,6})\s+(.*?)\s*$", line)
            if m and needle in m.group(2).lower():
                start = i
                start_level = len(m.group(1))
                break
        if start < 0:
            return ""
        end = len(lines)
        for j in range(start + 1, len(lines)):
            m = re.match(r"^(#{1,6})\s+", lines[j])
            if m and len(m.group(1)) <= start_level:
                end = j
                break
        return "\n".join(lines[start:end]).strip()
  • Database helper find_page_by_slug_or_title used by get_page handler. Attempts lookup by exact id, exact title, then substring (LIKE) match on title.
    def find_page_by_slug_or_title(conn: sqlite3.Connection, needle: str) -> sqlite3.Row | None:
        # 1) exact id, 2) exact title, 3) LIKE on title
        row = conn.execute("SELECT * FROM pages WHERE id = ? LIMIT 1", (needle,)).fetchone()
        if row:
            return row
        row = conn.execute("SELECT * FROM pages WHERE title = ? LIMIT 1", (needle,)).fetchone()
        if row:
            return row
        return conn.execute(
            "SELECT * FROM pages WHERE title LIKE ? ORDER BY length(title) ASC LIMIT 1",
            (f"%{needle}%",),
        ).fetchone()
  • The SQLite schema for the 'pages' table defines the shape of page data (id, title, url, parent_id, breadcrumb, space_key, version, updated_at, body_md) returned by the get_page tool.
    SCHEMA = """
    CREATE TABLE IF NOT EXISTS pages (
        id            TEXT PRIMARY KEY,           -- Confluence content id
        title         TEXT NOT NULL,
        url           TEXT NOT NULL,
        parent_id     TEXT,                       -- Confluence parent page id (or NULL)
        breadcrumb    TEXT NOT NULL,              -- "Home > Section > Page"
        space_key     TEXT NOT NULL,
        version       INTEGER NOT NULL DEFAULT 0,
        updated_at    TEXT,                       -- ISO8601
        body_md       TEXT NOT NULL,              -- full page as markdown
        fetched_at    TEXT NOT NULL DEFAULT (datetime('now'))
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 that the tool returns markdown content and optionally a section, but lacks details on permissions, rate limits, or error handling. Adequate for a simple read operation.

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 extremely concise: one sentence for purpose, then clear bullet-like Args. Every sentence adds value with no redundancy.

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

Completeness5/5

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

Given the tool's simplicity and the presence of an output schema, the description fully covers what the agent needs to know. Parameter details are clear, and no additional behavioral context is necessary.

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

Parameters5/5

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

The description adds significant meaning beyond the schema: page_ref accepts id, exact title, or substring; section is optional heading text to filter. This enriches the agent's understanding for correct invocation.

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 action (return) and resource (full markdown of a page). It distinguishes from siblings like list_sections (only sections) and search_docs (searching), as the name and description imply a specific retrieval function.

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 explains how to use the tool (page_ref can be id, title, or substring) and optional section filtering. It does not explicitly state when to use alternatives, but the sibling context and parameter semantics make it clear.

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/ThiTheGoat/of-mcp'

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