Skip to main content
Glama
TheOneTrueNiz

Grokipedia MCP Server

get_related_pages

Read-onlyIdempotent

Find related Grokipedia articles linked from a specific page to explore connected topics, build knowledge graphs, or conduct follow-up research.

Instructions

Discover related Grokipedia pages linked from an article.

Use for: exploring connected topics, building knowledge graphs, follow-up research. Returns: list of related pages with titles and slugs. Tips: Use returned slugs with get_page to dive into related topics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesUnique slug identifier of page to find related pages for
limitNoMaximum number of related pages to return (default: 10)

Implementation Reference

  • The get_related_pages tool handler implementation, which retrieves related pages for a given Grokipedia page slug.
    async def get_related_pages(
        slug: Annotated[str, Field(description="Unique slug identifier of page to find related pages for")],
        limit: Annotated[int, Field(description="Maximum number of related pages to return (default: 10)", ge=1, le=50)] = 10,
        ctx: Context[ServerSession, AppContext] | None = None,
    ) -> CallToolResult:
        """Discover related Grokipedia pages linked from an article.
    
        Use for: exploring connected topics, building knowledge graphs, follow-up research.
        Returns: list of related pages with titles and slugs.
        Tips: Use returned slugs with get_page to dive into related topics.
        """
        if ctx is None:
            raise ValueError("Context is required")
    
        await ctx.debug(f"Fetching related pages for: '{slug}' (limit={limit})")
    
        try:
            client = ctx.request_context.lifespan_context.client
            result = await client.get_page(slug=slug, include_content=False)
    
            if not result.found or result.page is None:
                await ctx.warning(f"Page not found: '{slug}'")
                raise ValueError(f"Page not found: {slug}")
    
            page = result.page
            linked_pages = page.linked_pages or []
            total_count = len(linked_pages)
            
            related = linked_pages[:limit] if limit else linked_pages
            is_limited = limit and total_count > limit
            
            await ctx.info(f"Found {len(related)} of {total_count} related pages for: '{page.title}'")
            
            if not linked_pages:
                text_output = f"# {page.title}\n\nNo related pages found."
                structured = {
                    "slug": page.slug,
                    "title": page.title,
                    "related_pages": [],
                    "total_count": 0,
                    "returned_count": 0,
                }
            else:
                header = f"# {page.title}\n\n"
                if is_limited:
                    header += f"Showing {len(related)} of {total_count} related pages:\n\n"
                else:
                    header += f"Found {total_count} related pages:\n\n"
                
                text_parts = [header]
                for i, rel_page in enumerate(related, 1):
                    if isinstance(rel_page, dict):
                        title = rel_page.get("title", "Unknown")
                        slug_val = rel_page.get("slug", "")
                    else:
                        title = str(rel_page)
                        slug_val = ""
                    text_parts.append(f"{i}. {title}")
                    if slug_val:
                        text_parts.append(f"   Slug: {slug_val}")
                    text_parts.append("")
                
                if is_limited:
                    text_parts.append(f"... and {total_count - len(related)} more")
                
                text_output = "\n".join(text_parts)
                structured = {
                    "slug": page.slug,
                    "title": page.title,
                    "related_pages": related,
                    "total_count": total_count,
                    "returned_count": len(related),
                }
                
                if is_limited:
                    structured["_limited"] = True
            
            return CallToolResult(
                content=[TextContent(type="text", text=text_output)],
                structuredContent=structured,
            )
  • Registration of the get_related_pages tool using the @mcp.tool decorator.
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True
        )
    )
Behavior4/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true. The description adds valuable behavioral context: it discloses the return format ('list of related pages with titles and slugs') and workflow integration ('Use returned slugs with get_page'), which is crucial given no output schema exists.

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?

Description uses clear structural headers ('Use for:', 'Returns:', 'Tips:') that front-load critical information. Every sentence earns its place — main purpose, use cases, return values, and workflow tips — with zero redundancy or filler.

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 lack of an output schema, the description adequately explains return values ('list of related pages with titles and slugs'). It also covers workflow integration with sibling tools (get_page). For a 2-parameter read-only tool with complete schema coverage, this description provides sufficient context for correct invocation.

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

Parameters3/5

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

Schema description coverage is 100%, with both 'slug' and 'limit' fully documented in the schema. The description mentions 'slugs' in the Tips section reinforcing the parameter concept, but does not add semantic meaning or format details beyond what the schema already provides. Baseline 3 is appropriate when schema carries the burden.

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 tool 'Discover[s] related Grokipedia pages linked from an article' — providing a specific verb (discover), resource (related pages), and scope (linked from an article). This effectively distinguishes it from siblings like get_page (content retrieval) and search (full-text search).

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 'Use for:' section explicitly lists scenarios: 'exploring connected topics, building knowledge graphs, follow-up research.' The 'Tips:' section mentions using returned slugs with get_page, providing workflow guidance that implicitly distinguishes this tool's output from get_page's full content retrieval. Lacks explicit 'when not to use' 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/TheOneTrueNiz/mcp-grokipedia-tool'

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