get_minecraft_version
Retrieve Minecraft version data from indexed modding documentation to access current version information or complete version lists for development reference.
Instructions
Get Minecraft version information from the indexed documentation. Returns either the latest version or all available versions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Type of version info: 'latest' for newest version, 'all' for complete list | latest |
Implementation Reference
- src/tools/getMinecraftVersion.ts:17-80 (handler)The main handler function that executes the logic for the 'get_minecraft_version' tool. It retrieves Minecraft version information (latest or all) from the ExampleService based on the input parameter.export function handleGetMinecraftVersion(params: GetMinecraftVersionParams): CallToolResult { try { const exampleService = new ExampleService(); const { type = 'latest' } = params; if (type === 'all') { const topics = exampleService.getAvailableTopics(); exampleService.close(); if (topics.versions.length === 0) { return { content: [ { type: 'text', text: 'No Minecraft versions found in the indexed documentation. Please run the indexer first.', }, ], }; } let output = `## Available Minecraft Versions\n\n`; output += `Found ${topics.versions.length} version(s) in the documentation:\n\n`; for (const version of topics.versions) { output += `- ${version}\n`; } output += `\n**Latest:** ${topics.versions[0] || 'unknown'}\n`; return { content: [ { type: 'text', text: output, }, ], }; } // Default: return latest version const latestVersion = exampleService.getLatestMinecraftVersion(); exampleService.close(); return { content: [ { type: 'text', text: `The latest Minecraft version in the documentation is: **${latestVersion}**`, }, ], }; } catch (error) { console.error('[get_minecraft_version] Error:', error); return { content: [ { type: 'text', text: `Error retrieving Minecraft version: ${error instanceof Error ? error.message : 'Unknown error'}\n\nThe documentation database may not be initialized.`, }, ], }; } }
- TypeScript interface defining the input parameters for the get_minecraft_version tool handler.export interface GetMinecraftVersionParams { type?: 'latest' | 'all'; }
- src/index.ts:156-171 (registration)Tool registration in the BASE_TOOLS array, including name, description, and input schema for the ListToolsRequestHandler.{ name: 'get_minecraft_version', description: 'Get Minecraft version information from the indexed documentation. Returns either the latest version or all available versions.', inputSchema: { type: 'object', properties: { type: { type: 'string', enum: ['latest', 'all'], description: "Type of version info: 'latest' for newest version, 'all' for complete list", default: 'latest', }, }, }, },
- src/index.ts:227-231 (handler)Dispatcher case in the central CallToolRequestHandler switch statement that invokes the specific handler for get_minecraft_version.case 'get_minecraft_version': { return handleGetMinecraftVersion({ type: (args?.type as 'latest' | 'all') || 'latest', }); }