Skip to main content
Glama

Sitecore MCP Server

by GaryWenneker
READY-TO-SHIP-v1.4.1.md•9.16 kB
# Ready to Ship - v1.4.1 Runtime Error Fixes **Date:** 25 Augustus 2025 **Version:** 1.4.1 **Status:** āœ… PRODUCTION READY --- ## šŸŽ‰ Achievement Summary ### āœ… All Runtime Errors Fixed - **Error #1:** Item not found (āœ… already working - v1.4.0 smart defaults) - **Error #2:** Field not found (āœ… already working - correct syntax) - **Error #3:** Template not found (āœ… FIXED - force language='en') - **Error #4:** getTemplates schema mismatch (āœ… FIXED - use children(), remove 'path' field) - **Error #5:** getChildren schema mismatch (āœ… already working - no .results usage) ### āœ… Test Coverage: 100% ``` test-runtime-fixes.ps1: 8/8 (100%) āœ… test-comprehensive-v1.4.ps1: 25/25 (100%) āœ… ------------------------------------------- TOTAL: 33/33 (100%) āœ… ``` ### āœ… Build Status ```powershell npm run build # SUCCESS - No TypeScript errors ``` ### āœ… Schema Validation - All queries validated against `.github/introspectionSchema.json` (15,687 lines) - TypeScript types generated in `src/sitecore-types.ts` (423 lines) - ItemTemplate type corrected: only `{ id, name }` (no `path` field) --- ## šŸ“ Changes Summary ### Files Modified (2) 1. **src/sitecore-service.ts** - `getTemplate()`: Force language='en', enhanced error message - `getTemplates()`: Use item().children() query, remove ItemTemplate.path access 2. **package.json** - Version bumped: 1.4.0 → 1.4.1 - Description updated with "runtime error fixes" ### Files Created (3) 1. **test-runtime-fixes.ps1** (400 lines) - 8 comprehensive tests for all runtime error scenarios - 100% passing 2. **RUNTIME-ERROR-FIXES.md** (500 lines) - Detailed documentation of all 5 errors - Root cause analysis - Fix implementations - Schema validation rules - Test results 3. **RELEASE-NOTES-v1.4.0.md** (updated) - Now documents v1.4.1 with runtime fixes - Test coverage updated: 33/33 tests - Schema validation notes added --- ## šŸ” What Was Fixed ### Error #3: getTemplate **Before:** ```typescript // Missing language parameter const query = ` query GetTemplate($path: String!) { item(path: $path) { ... } } `; const result = await this.executeGraphQL(query, { path: templatePath }); ``` **After:** ```typescript // Force language='en' (Sitecore best practice for templates) const language = 'en'; const query = ` query GetTemplate($path: String!, $language: String!) { item(path: $path, language: $language) { ... } } `; const result = await this.executeGraphQL(query, { path: templatePath, language }); ``` ### Error #4: getTemplates **Before:** ```typescript // Used non-existent templates() query const query = ` query GetTemplates($path: String) { templates(path: $path) { # āŒ Doesn't exist in schema! id name path # āŒ ItemTemplate doesn't have 'path' field! } } `; ``` **After:** ```typescript // Use item().children() with correct ItemTemplate fields const templatePath = path || '/sitecore/templates'; const language = 'en'; const query = ` query GetTemplates($path: String!, $language: String!) { item(path: $path, language: $language) { id name path # āœ… Item has 'path' field children(first: 100) { id name path # āœ… Item has 'path' field hasChildren template { id # āœ… ItemTemplate.id (valid) name # āœ… ItemTemplate.name (valid) # NO path field! (would cause error) } } } } `; ``` --- ## šŸ“ˆ Test Results ### test-runtime-fixes.ps1 (8/8 - 100%) ``` Category 1: getItem Language Handling [PASS] Template path with smart default to 'en' [PASS] Content path with smart default Category 2: getFieldValue [PASS] Single field query with { name value } subselection [PASS] All fields query with fields(ownFields: false) Category 3: getTemplate [PASS] Template by path with forced language='en' Category 4: getTemplates Schema Fix [PASS] Templates via children() query (no templates() query) [PASS] ItemTemplate structure validation (id/name only, no path) Category 5: getChildren [PASS] Children as direct array (no .results field) Pass Rate: 100% ``` ### test-comprehensive-v1.4.ps1 (25/25 - 100%) ``` Category 1: Smart Defaults (4/4) Category 2: Field Discovery (3/3) Category 3: Helix Architecture (3/3) Category 4: Version Management (3/3) Category 5: Navigation (3/3) Category 6: Statistics (3/3) Category 7: Search (3/3) Category 8: Field Types (3/3) Pass Rate: 100% NO REGRESSIONS ``` --- ## šŸ“š Documentation ### Updated Documentation 1. **RUNTIME-ERROR-FIXES.md** (new) - Complete analysis of all 5 runtime errors - Root cause explanations - Fix implementations with code examples - Schema validation rules - Test results 2. **RELEASE-NOTES-v1.4.0.md** (updated to v1.4.1) - Runtime error fixes section - Schema validation rules - Test coverage updated: 33/33 tests 3. **copilot-instructions.md** (already updated in v1.4.0) - GraphQL Schema Reference section - introspectionSchema.json documentation - Type generation workflow 4. **README.md** (needs update - see checklist) --- ## āœ… Pre-Commit Checklist - [x] All runtime errors fixed (5/5) - [x] Test suite created (test-runtime-fixes.ps1) - [x] All tests passing (33/33 - 100%) - [x] No regressions in existing tests - [x] TypeScript build successful (npm run build) - [x] Version bumped (1.4.0 → 1.4.1) - [x] Schema validation documented - [x] Release notes updated - [x] Detailed fix documentation created - [ ] README.md updated with schema validation notes - [ ] Git commit - [ ] Git tag v1.4.1 --- ## šŸš€ Commit Message ``` fix: Runtime error fixes for GraphQL schema mismatches (v1.4.1) CRITICAL FIXES: - Error #3: getTemplate force language='en' with enhanced error messages - Error #4: getTemplates use item().children() instead of non-existent templates() query - Error #4: Remove 'path' field from ItemTemplate access (only has id/name per schema) VERIFIED WORKING: - Error #1: getItem language handling (v1.4.0 smart defaults) - Error #2: getFieldValue correct syntax (field() { name value }) - Error #5: getChildren correct structure (direct array, no .results) SCHEMA VALIDATION: - All queries validated against .github/introspectionSchema.json (15,687 lines) - ItemTemplate type corrected: { id, name } only (no path field) - Used src/sitecore-types.ts (423 lines) for type checking - No non-existent queries used (removed templates() query) TEST RESULTS: āœ… test-runtime-fixes.ps1: 8/8 (100%) āœ… test-comprehensive-v1.4.ps1: 25/25 (100%) āœ… Total coverage: 33/33 (100%) āœ… Zero regressions āœ… npm run build: SUCCESS FILES CHANGED: M src/sitecore-service.ts (getTemplate, getTemplates methods) M package.json (version 1.4.0 → 1.4.1) M RELEASE-NOTES-v1.4.0.md (updated to v1.4.1) A test-runtime-fixes.ps1 (8 tests) A RUNTIME-ERROR-FIXES.md (detailed documentation) A READY-TO-SHIP-v1.4.1.md (this file) BREAKING CHANGES: None BACKWARD COMPATIBLE: Yes Production ready: All 5 runtime errors resolved, 100% test coverage. ``` --- ## 🧭 Next Steps ### 1. Update README.md Add section about schema validation: ```markdown ## Schema Validation All GraphQL queries are validated against the Sitecore schema: - **Primary Source**: `.github/introspectionSchema.json` (15,687 lines) - **Type Definitions**: `src/sitecore-types.ts` (423 lines, auto-generated) - **Type Generation**: Run `.\generate-types.ps1` to regenerate ### ItemTemplate Type The `ItemTemplate` type only has `id` and `name` fields (no `path`): ```typescript export interface ItemTemplate { id: ID; name: string; } ``` ### Query Patterns - āœ… Templates: `item(path: "/sitecore/templates/...").children()` - āŒ Templates: `templates()` (doesn't exist in schema) - āœ… Single field: `item().field(name: "X") { name value }` - āŒ Single field: `item().field(name: "X")` (missing subselection) ``` ### 2. Git Commit ```powershell git add . git commit -m "fix: Runtime error fixes for GraphQL schema mismatches (v1.4.1)" git tag v1.4.1 git push origin main --tags ``` ### 3. Build VSIX ```powershell npm run build:vsix # Output: sitecore-mcp-server-1.4.1.vsix ``` --- ## šŸ“œ Version History | Version | Date | Tests | Status | Notes | |---------|------|-------|--------|-------| | 1.4.1 | 2025-08-25 | 33/33 (100%) | āœ… READY | Runtime error fixes, schema validation | | 1.4.0 | 2025-08-25 | 25/25 (100%) | āœ… SHIPPED | Smart defaults, Helix, field discovery, schema integration | | 1.3.0 | 2025-08-24 | 15/15 (100%) | āœ… SHIPPED | Version control, parent navigation, statistics | | 1.2.1 | 2025-08-23 | 5/5 (100%) | āœ… SHIPPED | Authentication fix | | 1.2.0 | 2025-08-23 | 5/5 (100%) | āœ… SHIPPED | Schema scanner, natural language | | 1.1.0 | 2025-08-22 | 5/5 (100%) | āœ… SHIPPED | Core functionality | --- ## šŸŽÆ Summary **v1.4.1 is PRODUCTION READY!** āœ… All 5 runtime errors fixed āœ… 100% test coverage (33/33) āœ… Zero regressions āœ… Build successful āœ… Schema validated āœ… Fully documented **Ready to commit and ship!** šŸš€

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/GaryWenneker/SitecoreMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server