MinecraftWiki_getSectionsInPage
Retrieve a structured list of all sections within a specific Minecraft Wiki page by providing its title. Simplify navigation and access to detailed information.
Instructions
Retrieves an overview of all sections in the page.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Title of the page to retrieve sections for. |
Implementation Reference
- src/services/wiki.service.ts:196-217 (handler)The handler function that implements the core logic of the 'MinecraftWiki_getSectionsInPage' tool by fetching page sections from the MediaWiki API and formatting them as JSON.async getSectionsInPage(title: string): Promise<string> { const response = await apiService.get<WikiResponse, Record<string, unknown>>("", { action: "parse", page: title, prop: "sections", }); if (!response.parse?.sections?.length) { return JSON.stringify({ title: formatMCPText(title), sections: [], }); } return JSON.stringify({ title: formatMCPText(title), sections: response.parse.sections.map((section) => ({ index: parseInt(section.index), title: formatMCPText(section.line), })), }); }
- src/types/tools.ts:125-138 (schema)The Tool schema definition including name, description, and input schema for the 'MinecraftWiki_getSectionsInPage' tool.export const GET_SECTIONS_IN_PAGE_MINECRAFTWIKI_TOOL: Tool = { name: "MinecraftWiki_getSectionsInPage", description: "Retrieves an overview of all sections in the page.", inputSchema: { type: "object", properties: { title: { type: "string", description: "Title of the page to retrieve sections for.", }, }, required: ["title"], }, };
- src/server.ts:130-136 (registration)Tool registration in the CallToolRequestSchema handler switch statement, validating arguments and calling the wikiService handler.case GET_SECTIONS_IN_PAGE_MINECRAFTWIKI_TOOL.name: { if (!isGetSectionsInPageArgs(args)) { throw new Error("Invalid arguments for getSectionsInPage"); } const results = await wikiService.getSectionsInPage(args.title); return { content: [{ type: "text", text: results }] }; }
- src/server.ts:49-61 (registration)Tool registration in the ListToolsRequestSchema handler, including this tool 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:74-81 (schema)Type guard function for input argument validation matching the tool's input schema.export function isGetSectionsInPageArgs(args: unknown): args is { title: string } { return ( typeof args === "object" && args !== null && "title" in args && typeof (args as { title: string }).title === "string" ); }