|
1 | 1 | # Ensembl MCP Server - Improvement Plans |
2 | 2 |
|
3 | | -> 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), and Plan 12 (CI/CD) have been implemented. The plans below cover the next round of improvements. |
| 3 | +> 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. |
4 | 4 |
|
5 | 5 | --- |
6 | 6 |
|
@@ -94,46 +94,9 @@ Add an `ensembl_diagnostics` tool that exposes internal metrics and a health che |
94 | 94 |
|
95 | 95 | --- |
96 | 96 |
|
97 | | -## Plan 13: Pagination for Large Result Sets |
| 97 | +## ~~Plan 13: Pagination for Large Result Sets~~ (Implemented) |
98 | 98 |
|
99 | | -### Problem |
100 | | -Feature overlap queries on gene-dense regions can return thousands of results. Currently these are truncated, losing data silently. Users have no way to page through full results. |
101 | | - |
102 | | -### Approach |
103 | | -Add optional pagination parameters to tools that return arrays. |
104 | | - |
105 | | -### Parameters to Add |
106 | | - |
107 | | -On `ensembl_feature_overlap`, `ensembl_variation`, `ensembl_meta` (species): |
108 | | -- `page`: integer, default 1 |
109 | | -- `page_size`: integer, default 50, max 200 |
110 | | - |
111 | | -### Implementation |
112 | | - |
113 | | -**Modify: `src/utils/response-processor.ts`** |
114 | | -- Add `paginate(data: any[], page: number, pageSize: number): PaginatedResponse` |
115 | | -- `PaginatedResponse`: `{ data, page, page_size, total_results, total_pages, has_next }` |
116 | | - |
117 | | -**Modify: `src/handlers/tools.ts`** |
118 | | -- Add `page` and `page_size` to relevant tool schemas |
119 | | -- Apply pagination after response processing |
120 | | - |
121 | | -### Response Format |
122 | | -```json |
123 | | -{ |
124 | | - "data": [...], |
125 | | - "pagination": { |
126 | | - "page": 1, |
127 | | - "page_size": 50, |
128 | | - "total_results": 847, |
129 | | - "total_pages": 17, |
130 | | - "has_next": true |
131 | | - } |
132 | | -} |
133 | | -``` |
134 | | - |
135 | | -### Size Estimate |
136 | | -~40 lines for pagination logic, ~20 lines of schema changes. |
| 99 | +> Added `page` and `page_size` parameters to 5 tools (`ensembl_feature_overlap`, `ensembl_regulatory`, `ensembl_meta`, `ensembl_compara`, `ensembl_variation`). Extended `ProcessOptions` and `ProcessedResponse.metadata` with pagination fields (`page`, `page_size`, `total_pages`, `has_next`). Updated `truncateArray` to support offset-based slicing. `page_size` supersedes `max_results` when both provided. Out-of-range pages return empty data with correct metadata. Backward-compatible — omitting pagination params produces identical output. Added `validatePagination` to input validator, wired into all 5 tool validators. 220 tests across 7 files, all passing. |
137 | 100 |
|
138 | 101 | --- |
139 | 102 |
|
@@ -171,5 +134,5 @@ Use MCP's streaming capabilities for tools that can return large payloads. |
171 | 134 | | ~~4~~ | ~~Plan 12: CI/CD~~ | ~~High (quality gate)~~ | ~~Done~~ | |
172 | 135 | | ~~5~~ | ~~Plan 10: GRCh37 support~~ | ~~Medium (unlocks hg19 users)~~ | ~~Done~~ | |
173 | 136 | | 6 | Plan 11: Diagnostics tool | Medium (operational visibility) | Low | |
174 | | -| 7 | Plan 13: Pagination | Medium (better data access) | Low | |
| 137 | +| ~~7~~ | ~~Plan 13: Pagination~~ | ~~Medium (better data access)~~ | ~~Done~~ | |
175 | 138 | | 8 | Plan 14: Streaming | Low (nice-to-have) | Medium | |
0 commit comments