MinecraftWiki_getPageContent
Retrieve raw wikitext content from the Minecraft Wiki for a specific page title to access detailed information directly.
Instructions
Get the raw wikitext content of a specific Minecraft Wiki page.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Title of the Minecraft Wiki page to retrieve the raw wikitext content for. |
Input Schema (JSON Schema)
{
"properties": {
"title": {
"description": "Title of the Minecraft Wiki page to retrieve the raw wikitext content for.",
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
Implementation Reference
- src/services/wiki.service.ts:101-118 (handler)The handler function that fetches the raw wikitext content from the Minecraft Wiki using the MediaWiki API's parse action with prop=wikitext, sanitizes it, and returns JSON.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/types/tools.ts:61-74 (schema)Defines the Tool schema with name, description, and input JSON Schema requiring a 'title' string.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/server.ts:98-104 (registration)Registers the tool handler in the MCP server's CallToolRequestSchema by matching the tool name and calling 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/server.ts:49-61 (registration)Registers the tool in the ListToolsRequestSchema handler by including it in the list of available tools.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ SEARCH_WIKI_MINECRAFTWIKI_TOOL, GET_PAGE_SUMMARY_MINECRAFTWIKI_TOOL, GET_SECTIONS_IN_PAGE_MINECRAFTWIKI_TOOL, GET_PAGE_SECTION_MINECRAFTWIKI_TOOL, GET_PAGE_CONTENT_MINECRAFTWIKI_TOOL, RESOLVE_REDIRECT_MINECRAFTWIKI_TOOL, LIST_CATEGORY_MEMBERS_MINECRAFTWIKI_TOOL, LIST_ALL_CATEGORIES_MINECRAFTWIKI_TOOL, GET_CATEGORIES_FOR_PAGE_MINECRAFTWIKI_TOOL, ], }));
- src/types/guards.ts:36-43 (helper)Type guard function to validate input arguments for the getPageContent tool.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" ); }