Skip to main content
Glama

MinecraftWiki_getCategoriesForPage

Retrieve categories linked to a specific Minecraft Wiki page to organize and navigate content efficiently using the Minecraft Wiki MCP server.

Instructions

Get categories associated with a specific page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the Minecraft Wiki page

Implementation Reference

  • Implements the core logic for retrieving categories associated with a specific Minecraft Wiki page using the MediaWiki API's query prop='categories'. Formats and returns the result as JSON.
    async getCategoriesForPage(title: string): Promise<string> { const response = await apiService.get<WikiResponse, Record<string, unknown>>("", { action: "query", titles: title, prop: "categories", }); const pages = response.query?.pages; if (!pages) { throw new Error(`Failed to get categories for "${title}"`); } const page = Object.values(pages)[0]; if (page.missing) { throw new Error(`Page "${title}" not found`); } if (!page.categories?.length) { return JSON.stringify({ title: formatMCPText(title), categories: [], }); } return JSON.stringify({ title: formatMCPText(title), categories: page.categories.map((cat) => formatMCPText(cat.title)), }); }
  • Defines the Tool schema including name, description, and inputSchema for the MinecraftWiki_getCategoriesForPage tool.
    export const GET_CATEGORIES_FOR_PAGE_MINECRAFTWIKI_TOOL: Tool = { name: "MinecraftWiki_getCategoriesForPage", description: "Get categories associated with a specific page.", inputSchema: { type: "object", properties: { title: { type: "string", description: "Title of the Minecraft Wiki page", }, }, required: ["title"], }, };
  • src/server.ts:122-128 (registration)
    Registers the tool in the MCP server's CallToolRequestHandler switch statement, validating arguments and calling the wikiService handler.
    case GET_CATEGORIES_FOR_PAGE_MINECRAFTWIKI_TOOL.name: { if (!isGetCategoriesForPageArgs(args)) { throw new Error("Invalid arguments for getCategoriesForPage"); } const results = await wikiService.getCategoriesForPage(args.title); return { content: [{ type: "text", text: results }] }; }
  • Type guard function for validating the input arguments to the getCategoriesForPage tool.
    export function isGetCategoriesForPageArgs(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