Skip to main content
Glama

MinecraftWiki_getPageContent

Retrieve raw wikitext content from the Minecraft Wiki for specific pages to access detailed information and technical data.

Instructions

Get the raw wikitext content of a specific Minecraft Wiki page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the Minecraft Wiki page to retrieve the raw wikitext content for.

Implementation Reference

  • The core handler function that fetches raw wikitext content from the Minecraft Wiki API (action=parse&prop=wikitext), sanitizes it using sanitizeWikiContent, and returns JSON with title and content.
    async getPageContent(title: string): Promise<string> {
      const response = await apiService.get<WikiResponse, Record<string, unknown>>("", {
        action: "parse",
        page: title,
        prop: "wikitext",
      });
    
      const content = response.parse?.wikitext?.["*"];
    
      if (!content) {
        throw new Error(`No content found for page "${title}"`);
      }
    
      return JSON.stringify({
        title: formatMCPText(title),
        content: sanitizeWikiContent(content),
      });
    }
  • src/server.ts:98-104 (registration)
    Registers the tool in the MCP server's CallToolRequestSchema handler by matching the tool name, validating arguments with isGetPageContentArgs guard, and delegating to wikiService.getPageContent.
    case GET_PAGE_CONTENT_MINECRAFTWIKI_TOOL.name: {
      if (!isGetPageContentArgs(args)) {
        throw new Error("Invalid arguments for getPageContent");
      }
      const content = await wikiService.getPageContent(args.title);
      return { content: [{ type: "text", text: content }] };
    }
  • Defines the Tool object with name, description, and inputSchema requiring a 'title' string parameter.
    export const GET_PAGE_CONTENT_MINECRAFTWIKI_TOOL: Tool = {
      name: "MinecraftWiki_getPageContent",
      description: "Get the raw wikitext content of a specific Minecraft Wiki page.",
      inputSchema: {
        type: "object",
        properties: {
          title: {
            type: "string",
            description: "Title of the Minecraft Wiki page to retrieve the raw wikitext content for.",
          },
        },
        required: ["title"],
      },
    };
  • Type guard function used to validate input arguments match { title: string } before calling the handler.
    export function isGetPageContentArgs(args: unknown): args is { title: string } {
      return (
        typeof args === "object" &&
        args !== null &&
        "title" in args &&
        typeof (args as { title: string }).title === "string"
      );
    }
  • Utility function called by the handler to sanitize wiki content by removing HTML tags, decoding Unicode escapes, and formatting for MCP compatibility.
    export function sanitizeWikiContent(text: string): string {
      return formatMCPText(
        // First decode any Unicode escapes
        decodeUnicodeEscapes(
          // Remove HTML tags
          text.replace(/<[^>]*>/g, " ")
        )
      );
    }

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/L3-N0X/Minecraft-Wiki-MCP'

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