Skip to main content
Glama

list_sections

List pages from the documentation tree. Retrieve root pages or immediate children of a specified parent page.

Instructions

List pages in the documentation tree.

Args: parent_id: If omitted, returns root pages of the OF space. Otherwise returns immediate children of the given page id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parent_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual 'list_sections' tool handler — decorated with @mcp.tool(). It uses db.list_root_pages() or db.list_children() based on whether parent_id is provided, then formats results as a flat Markdown bullet list.
    @mcp.tool()
    def list_sections(parent_id: str | None = None) -> str:
        """List pages in the documentation tree.
    
        Args:
            parent_id: If omitted, returns root pages of the OF space. Otherwise
                       returns immediate children of the given page id.
        """
        with closing(_conn()) as conn:
            rows = db.list_root_pages(conn) if not parent_id else db.list_children(conn, parent_id)
        if not rows:
            if parent_id:
                return f"No children for page {parent_id}."
            return f"Index is empty. Run `of-mcp-crawl` first. Status: {_index_status()}"
        lines = [f"- {r['title']}  (id={r['id']})  {r['url']}" for r in rows]
        header = "Root pages:" if not parent_id else f"Children of {parent_id}:"
        return header + "\n" + "\n".join(lines)
  • Helper function list_root_pages: queries pages where parent_id IS NULL or empty, ordered by title. Used by list_sections when parent_id is None.
    def list_root_pages(conn: sqlite3.Connection) -> list[sqlite3.Row]:
        return list(
            conn.execute(
                "SELECT id, title, url FROM pages WHERE parent_id IS NULL OR parent_id = ''"
                " ORDER BY title"
            ).fetchall()
        )
  • Helper function list_children: queries immediate children of a given parent_id, ordered by title. Used by list_sections when parent_id is provided.
    def list_children(conn: sqlite3.Connection, parent_id: str) -> list[sqlite3.Row]:
        return list(
            conn.execute(
                "SELECT id, title, url FROM pages WHERE parent_id = ? ORDER BY title",
                (parent_id,),
            ).fetchall()
        )
  • The FastMCP server instance 'mcp' is created here. The @mcp.tool() decorator on list_sections registers it automatically with the MCP framework.
    mcp = FastMCP("of-mcp")
Behavior3/5

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

No annotations are provided, so the description must carry the burden. It discloses the hierarchical behavior (root vs children) but does not mention pagination, ordering, or potential side effects. The behavior is adequately described for a simple list 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 with two sentences, no superfluous words, and the key information is front-loaded. Every sentence earns its place.

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

Completeness4/5

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

Given the simplicity (1 optional parameter, no annotations, output schema exists), the description is nearly complete. It covers the essential behavior. Minor omission: no mention of error handling or invalid IDs, but acceptable for this tool.

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?

With schema description coverage at 0%, the description fully explains the sole parameter parent_id, including its default behavior and effect on output. This adds significant meaning beyond the schema's type-only definition.

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 'List pages in the documentation tree', using a specific verb and resource. It is easily distinguishable from sibling tools like get_page, search_docs, and answer_question.

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 when to omit parent_id (returns root pages) and when to provide it (returns immediate children), giving clear usage context. However, it does not explicitly mention when not to use this tool or alternatives.

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