MinecraftWiki_searchWiki
Search the Minecraft Wiki for specific structures, entities, items, or blocks using basic terms. Follow a step-by-step process to retrieve and navigate detailed content efficiently.
Instructions
Search the Minecraft Wiki for a specific structure, entity, item or block. NOTE: Only use for basic search terms like item/block/structure/entity names - complex queries (like 'loot table of X' or 'how to craft Y') will not work. For best results: 1. Search for the basic entity/structure/etc name first, 2. Then use getPageSummary to see available sections, 3. Finally use getPageSection to get specific section content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search term to find on the Minecraft Wiki. |
Implementation Reference
- src/services/wiki.service.ts:42-57 (handler)The primary handler function for the 'MinecraftWiki_searchWiki' tool. It queries the Minecraft Wiki's MediaWiki API search endpoint with the provided query, extracts search results, and returns them formatted as JSON using the createJsonSearchResult helper.async searchWiki(query: string): Promise<string> { const response = await apiService.get<WikiResponse, Record<string, unknown>>("", { action: "query", list: "search", srsearch: query, }); const results = response.query?.search; if (!results?.length) { return JSON.stringify({ results: [] }); } // Return JSON-formatted results return createJsonSearchResult(results); }
- src/types/tools.ts:4-18 (schema)The Tool type definition including name, description, and input schema (requiring a 'query' string) for the 'MinecraftWiki_searchWiki' tool.export const SEARCH_WIKI_MINECRAFTWIKI_TOOL: Tool = { name: "MinecraftWiki_searchWiki", description: "Search the Minecraft Wiki for a specific structure, entity, item or block. NOTE: Only use for basic search terms like item/block/structure/entity names - complex queries (like 'loot table of X' or 'how to craft Y') will not work. For best results: 1. Search for the basic entity/structure/etc name first, 2. Then use getPageSummary to see available sections, 3. Finally use getPageSection to get specific section content.", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search term to find on the Minecraft Wiki.", }, }, required: ["query"], }, };
- src/server.ts:74-80 (registration)The registration and dispatching logic in the MCP server's CallToolRequestHandler switch statement, which validates arguments using isSearchWikiArgs and calls wikiService.searchWiki.case SEARCH_WIKI_MINECRAFTWIKI_TOOL.name: { if (!isSearchWikiArgs(args)) { throw new Error("Invalid arguments for searchWiki"); } const results = await wikiService.searchWiki(args.query); return { content: [{ type: "text", text: results }] }; }
- src/server.ts:49-60 (registration)Registration of the tool in the server's ListToolsRequestHandler, making it discoverable by MCP clients.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/utils/utils.ts:69-79 (helper)Helper function used by the handler to format search results into a JSON structure with resultId, cleaned title, and truncated snippet.export function createJsonSearchResult(results: Array<{ title: string; snippet: string }>): string { if (!results || !results.length) return JSON.stringify({ results: [] }); const formattedResults = results.map((item, index) => ({ resultId: index + 1, title: formatMCPText(item.title), snippet: formatMCPText(item.snippet || "").substring(0, 100), })); return JSON.stringify({ results: formattedResults }); }