Plans 1-6 (caching, batch operations, response truncation, error handling, structured logging, retry logic), Plan 7 (Vitest), Plan 8 (MCP resources & prompts), Plan 9 (input validation), Plan 10 (GRCh37 support), Plan 12 (CI/CD), and Plan 13 (pagination) have been implemented. The plans below cover the next round of improvements.
Migrated to Vitest with
@vitest/coverage-v8. Deleted custom test runner and 12 integration test files. Createdvitest.config.ts, migratedinput-normalizer.test.tsandinput-validator.test.tsto Vitest syntax, and added new unit tests forcache.ts,error-handler.ts,response-processor.ts, andformatter.ts. 152 tests across 6 files, all passing. Scripts:npm test,npm run test:watch,npm run test:coverage.
Implemented in
eb43ce2. Addedsrc/handlers/resources.ts(species, releases, assembly, biotypes),src/handlers/prompts.ts(analyze-variant, compare-orthologs, region-survey, gene-report), and wired intoindex.tswith full MCP resource/prompt protocol support.
Implemented with
src/utils/species-data.ts(shared species constants),src/utils/input-validator.ts(8 validators + batch + tool-aware dispatcher for all 10 tools), wired intosrc/handlers/tools.ts, andtests/input-validator.test.ts(77 tests). Also deduplicated species data fromerror-handler.tsandinput-normalizer.ts.
Implemented with dynamic server routing based on assembly argument. Added
resolveBaseUrl(),getServerIdentifier(),checkGrch37Support()tosrc/utils/species-data.ts. Cache keys include server prefix for isolation. Per-server release version tracking viaMap<string, string>. All 15+ API methods and 7 batch methods threadbaseUrlthrough. Assembly parameter added to 8 tool schemas.validateAssembly()added to input validator. Unsupported GRCh37 endpoints (homology, genetree, cafe, alignment) fail fast with clear error. 187 tests across 7 files, all passing.
No runtime visibility into server health, cache effectiveness, or API performance. When users experience slowness or errors, there's no way to diagnose without reading raw logs.
Add an ensembl_diagnostics tool that exposes internal metrics and a health check.
Parameters:
check_type:"health"|"cache_stats"|"api_stats"|"full"
Returns:
{
"health": {
"ensembl_api": "reachable",
"ping_ms": 145,
"current_release": 114,
"server_version": "15.0"
},
"cache": {
"entries": 247,
"max_entries": 1000,
"hit_rate": "73.2%",
"hits": 891,
"misses": 326,
"evictions": 12,
"memory_estimate_kb": 1240
},
"api": {
"total_requests": 1217,
"errors": 14,
"retries": 8,
"avg_response_ms": 312,
"rate_limit_waits": 45
}
}Modify: src/utils/cache.ts
- Add
getStats(): CacheStatsmethod tracking hits, misses, evictions
Modify: src/utils/ensembl-api.ts
- Add request counters:
totalRequests,errors,retries,responseTimes[] - Add
getStats(): ApiStatsmethod - Add
healthCheck(): Promise<HealthStatus>-- calls/info/pingand/info/data
Modify: src/handlers/tools.ts
- Add
ensembl_diagnosticstool definition and handler
~50 lines for stats tracking, ~40 lines for the tool definition/handler.
Added
.github/workflows/ci.ymlwith three parallel jobs: typecheck (tsc --noEmit), unit tests (vitest run --coveragewith coverage artifact upload), and Docker build verification. Triggers on push to main and pull requests.
Added
pageandpage_sizeparameters to 5 tools (ensembl_feature_overlap,ensembl_regulatory,ensembl_meta,ensembl_compara,ensembl_variation). ExtendedProcessOptionsandProcessedResponse.metadatawith pagination fields (page,page_size,total_pages,has_next). UpdatedtruncateArrayto support offset-based slicing.page_sizesupersedesmax_resultswhen both provided. Out-of-range pages return empty data with correct metadata. Backward-compatible — omitting pagination params produces identical output. AddedvalidatePaginationto input validator, wired into all 5 tool validators. 220 tests across 7 files, all passing.
Large FASTA sequences and 200-item batch results get truncated at a hard limit. MCP supports streaming content, which would let clients receive data incrementally instead of losing it.
Use MCP's streaming capabilities for tools that can return large payloads.
ensembl_sequence-- FASTA output for long sequences or batch requestsensembl_compara-- large gene tree results- Batch operations -- 200-item results
Modify: src/handlers/tools.ts
- For qualifying responses, use MCP's
StreamableHTTPServerTransportor chunked text content - Fall back to truncation for clients that don't support streaming
~80 lines. Depends on MCP SDK streaming support maturity.
| Priority | Plan | Impact | Effort |
|---|---|---|---|
| 6 | Plan 11: Diagnostics tool | Medium (operational visibility) | Low |
| 8 | Plan 14: Streaming | Low (nice-to-have) | Medium |