Skip to content

Commit 5439752

Browse files
committed
fix: Add source filtering and reorganize test suite
- Add startLine, endLine, and maxLines parameters to get_minecraft_source tool to prevent large class responses (25k+ tokens) from disrupting workflows - Implement line filtering logic with metadata headers for filtered results - Add 8 comprehensive tests for source filtering on MC 1.21.11 - Remove "Phase" terminology from all test files - Reorganize tests by functional areas (Tool Registration, Source Filtering, Documentation and Index Resources, etc.) - Delete redundant analysis-tools.test.ts (functionality moved to core-tools) - Update test fixtures to use MC 1.21.11 and meteor-client 1.21.11-4 - Fix lint issues: parameter reassignment, type safety, formatting All 183 tests pass with no regressions.
1 parent 270d60c commit 5439752

File tree

10 files changed

+402
-138
lines changed

10 files changed

+402
-138
lines changed

.claude/settings.local.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,5 @@
3838
]
3939
},
4040
"enableAllProjectMcpServers": true,
41-
"enabledMcpjsonServers": [
42-
"minecraft-dev"
43-
]
41+
"enabledMcpjsonServers": ["minecraft-dev"]
4442
}

__tests__/resources/mcp-resources.test.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { TEST_MAPPING, TEST_VERSION } from '../test-constants.js';
88
* MCP Resources Tests
99
*
1010
* Tests the MCP resource definitions and handlers for:
11-
* - Phase 1: Source code, mappings, registry, versions list
12-
* - Phase 2: Documentation, search index, topics
11+
* - Source code, mappings, registry, versions list
12+
* - Documentation, search index, topics
1313
*/
1414

1515
describe('MCP Resources', () => {
@@ -21,15 +21,21 @@ describe('MCP Resources', () => {
2121
it('should have resource templates defined', () => {
2222
expect(resourceTemplates).toBeDefined();
2323
expect(Array.isArray(resourceTemplates)).toBe(true);
24-
// Phase 1: 4 templates, Phase 2: 4 templates = 8 total (Phase 3 has no resources)
2524
expect(resourceTemplates.length).toBe(8);
2625

27-
// Check Phase 1 templates are present
2826
const templateUris = resourceTemplates.map((t) => t.uriTemplate);
27+
28+
// Source and data templates
2929
expect(templateUris).toContain('minecraft://source/{version}/{mapping}/{className}');
3030
expect(templateUris).toContain('minecraft://mappings/{version}/{mapping}');
3131
expect(templateUris).toContain('minecraft://registry/{version}/{registryType}');
3232
expect(templateUris).toContain('minecraft://versions/list');
33+
34+
// Documentation and index templates
35+
expect(templateUris).toContain('minecraft://docs/{className}');
36+
expect(templateUris).toContain('minecraft://docs/topic/{topic}');
37+
expect(templateUris).toContain('minecraft://index/{version}/{mapping}');
38+
expect(templateUris).toContain('minecraft://index/list');
3339
});
3440

3541
it('should have static resources defined', () => {
@@ -77,26 +83,29 @@ describe('MCP Resources', () => {
7783
}, 300000);
7884
});
7985

80-
describe('Phase 2 Resources', () => {
81-
it('should have Phase 2 resource templates defined', async () => {
86+
describe('Documentation and Index Resources', () => {
87+
it('should have documentation and index templates defined', async () => {
8288
const { resourceTemplates } = await import('../../src/server/resources.js');
8389

8490
expect(resourceTemplates).toBeDefined();
85-
expect(resourceTemplates.length).toBe(8); // 4 Phase 1 + 4 Phase 2
91+
expect(resourceTemplates.length).toBe(8);
8692

8793
const templateUris = resourceTemplates.map((t) => t.uriTemplate);
88-
// Phase 2 templates
94+
95+
// Documentation templates
8996
expect(templateUris).toContain('minecraft://docs/{className}');
9097
expect(templateUris).toContain('minecraft://docs/topic/{topic}');
98+
99+
// Index templates
91100
expect(templateUris).toContain('minecraft://index/{version}/{mapping}');
92101
expect(templateUris).toContain('minecraft://index/list');
93102
});
94103

95-
it('should have Phase 2 static resources defined', async () => {
104+
it('should have static resources for documentation topics', async () => {
96105
const { resources } = await import('../../src/server/resources.js');
97106

98107
expect(resources).toBeDefined();
99-
expect(resources.length).toBe(4); // 1 Phase 1 + 3 Phase 2 (Phase 3 has no static resources)
108+
expect(resources.length).toBe(4);
100109

101110
const uris = resources.map((r) => r.uri);
102111
expect(uris).toContain('minecraft://index/list');

__tests__/services/mod-analyzer-service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('ModAnalyzerService', () => {
3434
expect(result.metadata.id).toBe('meteor-client');
3535

3636
// Version should match the version in fabric.mod.json
37-
expect(result.metadata.version).toBe('1.21.10-32');
37+
expect(result.metadata.version).toBe('1.21.11-4');
3838

3939
// Should have a display name
4040
expect(result.metadata.name).toBe('Meteor Client');

__tests__/tools/analysis-tools.test.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)