explain_fabric_concept
Explains Fabric and Minecraft modding concepts like mixins, registries, and events to help developers understand terminology and architectural patterns.
Instructions
Get detailed explanation of a Fabric or Minecraft modding concept. Use this to understand fundamental concepts, terminology, or architectural patterns.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| concept | Yes | Concept to explain (e.g., 'mixins', 'registries', 'sided logic', 'fabric.mod.json', 'events') |
Implementation Reference
- src/tools/explainConcept.ts:27-99 (handler)Core handler function for 'explain_fabric_concept' tool: validates input, retrieves explanation using ConceptService, formats output, handles errors and suggestions.export async function handleExplainConcept(params: ExplainConceptParams): Promise<CallToolResult> { const { concept } = params; // Validate input if (!concept || typeof concept !== 'string' || concept.trim().length === 0) { return { content: [ { type: 'text', text: 'Error: Concept parameter is required and cannot be empty.', }, ], isError: true, }; } const trimmedConcept = concept.trim(); // Check for very long input if (trimmedConcept.length > 100) { return { content: [ { type: 'text', text: 'Error: Concept should be a concise term or phrase (max 100 characters). Examples: "mixins", "registry", "sided logic".', }, ], isError: true, }; } try { const service = getConceptService(); // Get comprehensive explanation const explanation = await service.explainConcept(trimmedConcept); // Format for AI const formattedOutput = service.formatForAI(explanation); // Add suggestions if few results let suggestions = ''; if (explanation.metadata.sourcesUsed < 2) { suggestions = '\n\n**Note:** Limited information found for this concept. '; suggestions += 'Try:\n'; suggestions += '- Using a more common term (e.g., "mixin" instead of "bytecode injection")\n'; suggestions += '- Checking spelling\n'; suggestions += '- Using `search_fabric_docs` for broader search\n'; } return { content: [ { type: 'text', text: formattedOutput + suggestions, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); console.error(`[explainConcept] Error: ${errorMessage}`); return { content: [ { type: 'text', text: `Error explaining concept: ${errorMessage}\n\nPlease ensure the documentation database has been indexed. Run 'npm run index-docs' to build the database.`, }, ], isError: true, }; } }
- src/index.ts:140-155 (schema)Tool schema definition including name, description, and input schema for 'explain_fabric_concept' in the BASE_TOOLS array.{ name: 'explain_fabric_concept', description: 'Get detailed explanation of a Fabric or Minecraft modding concept. Use this to understand fundamental concepts, terminology, or architectural patterns.', inputSchema: { type: 'object', properties: { concept: { type: 'string', description: "Concept to explain (e.g., 'mixins', 'registries', 'sided logic', 'fabric.mod.json', 'events')", }, }, required: ['concept'], }, },
- src/index.ts:221-225 (registration)Switch case in CallToolRequestHandler that registers and dispatches 'explain_fabric_concept' calls to the handler function.case 'explain_fabric_concept': { return await handleExplainConcept({ concept: (args?.concept as string) || '', }); }
- src/index.ts:13-13 (registration)Import statement that brings in the handler function for registration.import { handleExplainConcept } from './tools/explainConcept.js';
- src/tools/explainConcept.ts:9-11 (schema)TypeScript interface defining the input parameters for the handler.export interface ExplainConceptParams { concept: string; }