Skip to main content
Glama
TheOneTrueNiz

Grokipedia MCP Server

get_page

Read-onlyIdempotent

Retrieve complete Grokipedia articles with metadata, content previews, and citations for reading, overviews, and source verification.

Instructions

Get complete Grokipedia page with metadata, content preview, and citations.

Use for: reading articles, getting overviews, checking citations and sources. Returns: title, description, content preview (truncated), citations list. Tips: Use get_page_content for full untruncated content. Slug comes from search results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesUnique slug identifier of the page to retrieve
max_content_lengthNoMaximum length of content to return (default: 5000)

Implementation Reference

  • The implementation of the get_page tool, which fetches a page from Grokipedia.
    async def get_page(
        slug: Annotated[str, Field(description="Unique slug identifier of the page to retrieve")],
        max_content_length: Annotated[int, Field(description="Maximum length of content to return (default: 5000)", ge=100)] = 5000,
        ctx: Context[ServerSession, AppContext] | None = None,
    ) -> CallToolResult:
        """Get complete Grokipedia page with metadata, content preview, and citations.
    
        Use for: reading articles, getting overviews, checking citations and sources.
        Returns: title, description, content preview (truncated), citations list.
        Tips: Use get_page_content for full untruncated content. Slug comes from search results.
        """
        if ctx is None:
            raise ValueError("Context is required")
    
        await ctx.debug(f"Fetching page: '{slug}'")
    
        try:
            client = ctx.request_context.lifespan_context.client
            result = await client.get_page(slug=slug, include_content=True)
    
            if not result.found or result.page is None:
                await ctx.warning(f"Page not found: '{slug}', searching for alternatives")
                search_result = await client.search(query=slug, limit=5)
                if search_result.results:
                    suggestions = [f"{r.title} ({r.slug})" for r in search_result.results[:3]]
                    await ctx.info(f"Found {len(search_result.results)} similar pages")
                    raise ValueError(
                        f"Page not found: {slug}. Did you mean one of these? {', '.join(suggestions)}"
                    )
                raise ValueError(f"Page not found: {slug}")
    
            await ctx.info(f"Retrieved page: '{result.page.title}' ({slug})")
            
            page = result.page
            content_len = len(page.content) if page.content else 0
            is_truncated = content_len > max_content_length
            
            text_parts = [
                f"# {page.title}",
                "",
                f"**Slug:** {page.slug}",
            ]
            
            if page.description:
                text_parts.extend(["", f"**Description:** {page.description}", ""])
            
            if page.content:
                preview_length = min(1000, max_content_length)
  • The registration of the get_page tool using the @mcp.tool decorator.
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True
        )
    )

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