Skip to main content
Glama

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
NameRequiredDescriptionDefault
titleYesTitle of the page to retrieve sections for.

Implementation Reference

  • 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), })), }); }
  • 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 }] }; }
  • 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" ); }

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