MinecraftWiki_getSectionsInPage
Retrieve all section headings from a Minecraft Wiki page to navigate content and locate specific information efficiently.
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 core handler function `getSectionsInPage` that queries the MediaWiki API for sections in the given page and returns formatted JSON with title and list of sections.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 exported as GET_SECTIONS_IN_PAGE_MINECRAFTWIKI_TOOL, including name, description, and input schema matching the handler.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)Registration in the CallToolRequestHandler switch statement that validates arguments using the type guard and delegates to 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/types/guards.ts:74-81 (helper)Type guard helper function used to validate the input arguments for the getSectionsInPage tool before calling the handler.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" ); }