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
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Title of the Minecraft Wiki page to retrieve the raw wikitext content for. |
Implementation Reference
- src/services/wiki.service.ts:101-118 (handler)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 }] }; }
- src/types/tools.ts:61-74 (schema)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"], }, };
- src/types/guards.ts:36-43 (helper)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" ); }
- src/utils/utils.ts:40-48 (helper)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, " ") ) ); }