@cyanheads/ensembl-mcp-server 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/AGENTS.md +383 -0
  2. package/CLAUDE.md +383 -0
  3. package/Dockerfile +99 -0
  4. package/LICENSE +201 -0
  5. package/README.md +326 -0
  6. package/changelog/0.1.x/0.1.1.md +31 -0
  7. package/changelog/template.md +127 -0
  8. package/dist/config/server-config.d.ts +14 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +21 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +40 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.d.ts +10 -0
  17. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.d.ts.map +1 -0
  18. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.js +60 -0
  19. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.js.map +1 -0
  20. package/dist/mcp-server/resources/definitions/gene.resource.d.ts +15 -0
  21. package/dist/mcp-server/resources/definitions/gene.resource.d.ts.map +1 -0
  22. package/dist/mcp-server/resources/definitions/gene.resource.js +59 -0
  23. package/dist/mcp-server/resources/definitions/gene.resource.js.map +1 -0
  24. package/dist/mcp-server/resources/definitions/species.resource.d.ts +15 -0
  25. package/dist/mcp-server/resources/definitions/species.resource.d.ts.map +1 -0
  26. package/dist/mcp-server/resources/definitions/species.resource.js +48 -0
  27. package/dist/mcp-server/resources/definitions/species.resource.js.map +1 -0
  28. package/dist/mcp-server/resources/definitions/transcript.resource.d.ts +15 -0
  29. package/dist/mcp-server/resources/definitions/transcript.resource.d.ts.map +1 -0
  30. package/dist/mcp-server/resources/definitions/transcript.resource.js +53 -0
  31. package/dist/mcp-server/resources/definitions/transcript.resource.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/get-homology.tool.d.ts +43 -0
  33. package/dist/mcp-server/tools/definitions/get-homology.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/get-homology.tool.js +183 -0
  35. package/dist/mcp-server/tools/definitions/get-homology.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/get-sequence.tool.d.ts +35 -0
  37. package/dist/mcp-server/tools/definitions/get-sequence.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/get-sequence.tool.js +154 -0
  39. package/dist/mcp-server/tools/definitions/get-sequence.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/get-xrefs.tool.d.ts +28 -0
  41. package/dist/mcp-server/tools/definitions/get-xrefs.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/get-xrefs.tool.js +122 -0
  43. package/dist/mcp-server/tools/definitions/get-xrefs.tool.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/list-species.tool.d.ts +28 -0
  45. package/dist/mcp-server/tools/definitions/list-species.tool.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/definitions/list-species.tool.js +105 -0
  47. package/dist/mcp-server/tools/definitions/list-species.tool.js.map +1 -0
  48. package/dist/mcp-server/tools/definitions/lookup-gene.tool.d.ts +57 -0
  49. package/dist/mcp-server/tools/definitions/lookup-gene.tool.d.ts.map +1 -0
  50. package/dist/mcp-server/tools/definitions/lookup-gene.tool.js +254 -0
  51. package/dist/mcp-server/tools/definitions/lookup-gene.tool.js.map +1 -0
  52. package/dist/mcp-server/tools/definitions/predict-variant.tool.d.ts +58 -0
  53. package/dist/mcp-server/tools/definitions/predict-variant.tool.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/definitions/predict-variant.tool.js +246 -0
  55. package/dist/mcp-server/tools/definitions/predict-variant.tool.js.map +1 -0
  56. package/dist/mcp-server/tools/definitions/query-region.tool.d.ts +48 -0
  57. package/dist/mcp-server/tools/definitions/query-region.tool.d.ts.map +1 -0
  58. package/dist/mcp-server/tools/definitions/query-region.tool.js +162 -0
  59. package/dist/mcp-server/tools/definitions/query-region.tool.js.map +1 -0
  60. package/dist/services/ensembl/ensembl-service.d.ts +32 -0
  61. package/dist/services/ensembl/ensembl-service.d.ts.map +1 -0
  62. package/dist/services/ensembl/ensembl-service.js +366 -0
  63. package/dist/services/ensembl/ensembl-service.js.map +1 -0
  64. package/dist/services/ensembl/types.d.ts +289 -0
  65. package/dist/services/ensembl/types.d.ts.map +1 -0
  66. package/dist/services/ensembl/types.js +6 -0
  67. package/dist/services/ensembl/types.js.map +1 -0
  68. package/package.json +106 -0
  69. package/server.json +113 -0
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @fileoverview Tool to list Ensembl-supported species with display names, assemblies, and taxon IDs.
3
+ * @module mcp-server/tools/definitions/list-species
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { getEnsemblService } from '../../../services/ensembl/ensembl-service.js';
7
+ const DIVISION_VALUES = [
8
+ 'EnsemblVertebrates',
9
+ 'EnsemblPlants',
10
+ 'EnsemblFungi',
11
+ 'EnsemblMetazoa',
12
+ 'EnsemblProtists',
13
+ ];
14
+ const SpeciesItemSchema = z.object({
15
+ name: z
16
+ .string()
17
+ .describe('Ensembl internal species name in lowercase_underscore format (e.g. homo_sapiens, mus_musculus). ' +
18
+ 'This is the value to pass as the species parameter in all other Ensembl tools.'),
19
+ displayName: z
20
+ .string()
21
+ .optional()
22
+ .describe('Human-readable scientific name (e.g. Homo sapiens).'),
23
+ commonName: z.string().optional().describe('Common name (e.g. Human, Mouse).'),
24
+ taxonId: z.string().optional().describe('NCBI taxonomy ID for this species.'),
25
+ assembly: z.string().optional().describe('Current genome assembly name (e.g. GRCh38).'),
26
+ division: z
27
+ .string()
28
+ .optional()
29
+ .describe('Ensembl division this species belongs to (e.g. EnsemblVertebrates, EnsemblPlants).'),
30
+ });
31
+ export const ensemblListSpecies = tool('ensembl_list_species', {
32
+ title: 'List Ensembl Species',
33
+ description: 'List species supported by Ensembl with display name, common name, assembly, taxon ID, and division. ' +
34
+ 'Required discovery step — species names like homo_sapiens are opaque to non-biologists and are the ' +
35
+ 'input format every other Ensembl tool expects. Filter by division to limit results; use nameContains ' +
36
+ 'to find a species by partial name match. Returns the full species catalog when no filters are applied ' +
37
+ '(EnsemblVertebrates has ~250 species; all divisions combined have ~1,000+).',
38
+ annotations: { readOnlyHint: true, openWorldHint: false, idempotentHint: true },
39
+ input: z.object({
40
+ division: z
41
+ .enum(DIVISION_VALUES)
42
+ .optional()
43
+ .describe('Filter to a specific Ensembl division. ' +
44
+ 'EnsemblVertebrates includes human, mouse, zebrafish, and other vertebrates. ' +
45
+ 'EnsemblPlants covers crop and model plant genomes. ' +
46
+ 'EnsemblFungi, EnsemblMetazoa, EnsemblProtists cover non-vertebrate model organisms. ' +
47
+ 'Omit to return all divisions.'),
48
+ nameContains: z
49
+ .string()
50
+ .optional()
51
+ .describe('Case-insensitive substring filter applied locally after fetching. ' +
52
+ 'Matches against species name, display name, and common name. ' +
53
+ 'Example: "sapiens" matches homo_sapiens; "mouse" matches mus_musculus.'),
54
+ }),
55
+ output: z.object({
56
+ species: z
57
+ .array(SpeciesItemSchema.describe('A single Ensembl species entry.'))
58
+ .describe('Species matching the filter criteria, sorted by internal name.'),
59
+ totalCount: z.number().describe('Total number of matching species after local filtering.'),
60
+ }),
61
+ enrichment: {
62
+ notice: z.string().optional().describe('Guidance when the filter matches no species.'),
63
+ },
64
+ async handler(input, ctx) {
65
+ ctx.log.info('Listing species', { division: input.division, nameContains: input.nameContains });
66
+ const service = getEnsemblService();
67
+ let species = await service.listSpecies(input.division, ctx);
68
+ if (input.nameContains?.trim()) {
69
+ const q = input.nameContains.toLowerCase();
70
+ const tokens = q.split(/\s+/).filter(Boolean);
71
+ species = species.filter((s) => {
72
+ const hay = [s.name, s.displayName, s.commonName].filter(Boolean).join(' ').toLowerCase();
73
+ return tokens.every((t) => hay.includes(t));
74
+ });
75
+ if (species.length === 0) {
76
+ ctx.enrich.notice(`No species matched "${input.nameContains}". ` +
77
+ 'Call ensembl_list_species without nameContains to browse all species.');
78
+ }
79
+ }
80
+ species.sort((a, b) => a.name.localeCompare(b.name));
81
+ ctx.enrich.total(species.length);
82
+ return { species, totalCount: species.length };
83
+ },
84
+ format: (result) => {
85
+ if (result.species.length === 0) {
86
+ return [{ type: 'text', text: 'No matching species found.' }];
87
+ }
88
+ const lines = [`## Ensembl Species (${result.totalCount} total)\n`];
89
+ for (const s of result.species) {
90
+ const label = s.displayName ?? s.name;
91
+ const common = s.commonName ? ` (${s.commonName})` : '';
92
+ lines.push(`**${label}**${common}`);
93
+ lines.push(`- Internal name: \`${s.name}\``);
94
+ if (s.assembly)
95
+ lines.push(`- Assembly: ${s.assembly}`);
96
+ if (s.taxonId)
97
+ lines.push(`- Taxon ID: ${s.taxonId}`);
98
+ if (s.division)
99
+ lines.push(`- Division: ${s.division}`);
100
+ lines.push('');
101
+ }
102
+ return [{ type: 'text', text: lines.join('\n') }];
103
+ },
104
+ });
105
+ //# sourceMappingURL=list-species.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-species.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-species.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,eAAe,GAAG;IACtB,oBAAoB;IACpB,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,iBAAiB;CACT,CAAC;AAEX,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,CACP,kGAAkG;QAChG,gFAAgF,CACnF;IACH,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,qDAAqD,CAAC;IACl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,EAAE,CAAC,CAAC;YACtD,IAAI,CAAC,CAAC,QAAQ;gBAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @fileoverview Tool to resolve genes by symbol + species or by Ensembl stable ID.
3
+ * @module mcp-server/tools/definitions/lookup-gene
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const ensemblLookupGene: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ symbol: z.ZodOptional<z.ZodString>;
9
+ id: z.ZodOptional<z.ZodString>;
10
+ species: z.ZodOptional<z.ZodString>;
11
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
+ symbols: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ expand_transcripts: z.ZodDefault<z.ZodBoolean>;
14
+ }, z.core.$strip>, z.ZodObject<{
15
+ gene: z.ZodOptional<z.ZodObject<{
16
+ id: z.ZodString;
17
+ species: z.ZodOptional<z.ZodString>;
18
+ displayName: z.ZodOptional<z.ZodString>;
19
+ description: z.ZodOptional<z.ZodString>;
20
+ biotype: z.ZodOptional<z.ZodString>;
21
+ chromosome: z.ZodOptional<z.ZodString>;
22
+ start: z.ZodOptional<z.ZodNumber>;
23
+ end: z.ZodOptional<z.ZodNumber>;
24
+ strand: z.ZodOptional<z.ZodNumber>;
25
+ assemblyName: z.ZodOptional<z.ZodString>;
26
+ transcripts: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
+ id: z.ZodString;
28
+ displayName: z.ZodOptional<z.ZodString>;
29
+ biotype: z.ZodOptional<z.ZodString>;
30
+ isCanonical: z.ZodBoolean;
31
+ start: z.ZodOptional<z.ZodNumber>;
32
+ end: z.ZodOptional<z.ZodNumber>;
33
+ strand: z.ZodOptional<z.ZodNumber>;
34
+ lengthInBp: z.ZodOptional<z.ZodNumber>;
35
+ }, z.core.$strip>>>;
36
+ }, z.core.$strip>>;
37
+ batch: z.ZodOptional<z.ZodObject<{
38
+ succeeded: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
39
+ failed: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
40
+ }, z.core.$strip>>;
41
+ }, z.core.$strip>, readonly [{
42
+ readonly reason: "not_found";
43
+ readonly code: JsonRpcErrorCode.NotFound;
44
+ readonly when: "The gene symbol or stable ID was not found in Ensembl.";
45
+ readonly recovery: string;
46
+ }, {
47
+ readonly reason: "invalid_species";
48
+ readonly code: JsonRpcErrorCode.ValidationError;
49
+ readonly when: "The species string was not recognized by Ensembl.";
50
+ readonly recovery: string;
51
+ }, {
52
+ readonly reason: "no_input";
53
+ readonly code: JsonRpcErrorCode.InvalidParams;
54
+ readonly when: "Neither symbol, id, ids, nor symbols was provided.";
55
+ readonly recovery: "Provide exactly one of: symbol (with species), id, ids array, or symbols array (with species).";
56
+ }], undefined>;
57
+ //# sourceMappingURL=lookup-gene.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup-gene.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/lookup-gene.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAmEjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmO5B,CAAC"}
@@ -0,0 +1,254 @@
1
+ /**
2
+ * @fileoverview Tool to resolve genes by symbol + species or by Ensembl stable ID.
3
+ * @module mcp-server/tools/definitions/lookup-gene
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getEnsemblService } from '../../../services/ensembl/ensembl-service.js';
8
+ const TranscriptSummarySchema = z.object({
9
+ id: z.string().describe('Ensembl transcript stable ID (ENST…).'),
10
+ displayName: z.string().optional().describe('Transcript display name.'),
11
+ biotype: z
12
+ .string()
13
+ .optional()
14
+ .describe('Transcript biotype (e.g. protein_coding, lncRNA, retained_intron).'),
15
+ isCanonical: z.boolean().describe('True when this is the canonical transcript for the gene.'),
16
+ start: z.number().optional().describe('Transcript start position on the chromosome (1-based).'),
17
+ end: z.number().optional().describe('Transcript end position on the chromosome (1-based).'),
18
+ strand: z.number().optional().describe('Strand: 1 for forward, -1 for reverse.'),
19
+ lengthInBp: z.number().optional().describe('Transcript length in base pairs.'),
20
+ });
21
+ const GeneResultSchema = z.object({
22
+ id: z
23
+ .string()
24
+ .describe('Ensembl gene stable ID (ENSG…). Use this as input to other Ensembl tools.'),
25
+ species: z
26
+ .string()
27
+ .optional()
28
+ .describe('Species in Ensembl internal format (e.g. homo_sapiens). Echoed from lookup.'),
29
+ displayName: z.string().optional().describe('Gene symbol or display name (e.g. BRCA2, TP53).'),
30
+ description: z.string().optional().describe('Brief gene description from Ensembl.'),
31
+ biotype: z
32
+ .string()
33
+ .optional()
34
+ .describe('Gene biotype (e.g. protein_coding, lncRNA, pseudogene).'),
35
+ chromosome: z.string().optional().describe('Chromosome or sequence region name.'),
36
+ start: z.number().optional().describe('Gene start position on the chromosome (1-based).'),
37
+ end: z.number().optional().describe('Gene end position on the chromosome (1-based).'),
38
+ strand: z.number().optional().describe('Strand: 1 for forward, -1 for reverse.'),
39
+ assemblyName: z
40
+ .string()
41
+ .optional()
42
+ .describe('Genome assembly name (e.g. GRCh38). All coordinates are relative to this assembly.'),
43
+ transcripts: z
44
+ .array(TranscriptSummarySchema.describe('A single transcript summary entry.'))
45
+ .optional()
46
+ .describe('Transcript list. Present only when expand_transcripts is true.'),
47
+ });
48
+ const BatchResultSchema = z.object({
49
+ // passthrough() — fields rendered via format()'s renderGene helper, not individually listed.
50
+ succeeded: z
51
+ .array(z
52
+ .object({})
53
+ .passthrough()
54
+ .describe('A resolved gene record with the same shape as the gene output field.'))
55
+ .describe('Gene records for IDs/symbols that resolved successfully. Same shape as gene.'),
56
+ failed: z
57
+ .array(z
58
+ .object({})
59
+ .passthrough()
60
+ .describe('A failed lookup entry with query (the submitted ID or symbol) and error (reason string) fields.'))
61
+ .describe('IDs/symbols that could not be resolved, with per-item query and error fields.'),
62
+ });
63
+ export const ensemblLookupGene = tool('ensembl_lookup_gene', {
64
+ title: 'Lookup Gene',
65
+ description: 'Resolve a gene by symbol + species (or by stable ID) to its Ensembl ID, genomic location ' +
66
+ '(chr:start-end:strand), biotype, description, and transcript list. Entry point for most workflows — ' +
67
+ 'the stable ID and coordinates returned here are inputs to other tools. Accepts both symbol lookup ' +
68
+ '(BRCA2 + homo_sapiens) and direct ID lookup (ENSG00000139618). Supports batch lookup of up to 20 ' +
69
+ 'IDs or symbols in one call via the ids or symbols field. For symbol lookup, species is required; ' +
70
+ 'for ID lookup, species is not needed. Use ensembl_list_species to discover valid species names.',
71
+ annotations: { readOnlyHint: true, openWorldHint: true, idempotentHint: true },
72
+ input: z.object({
73
+ symbol: z
74
+ .string()
75
+ .optional()
76
+ .describe('Gene symbol to look up (e.g. BRCA2, TP53, EGFR). ' +
77
+ 'Requires species to be set. Case-insensitive in most species.'),
78
+ id: z
79
+ .string()
80
+ .optional()
81
+ .describe('Ensembl stable gene ID (e.g. ENSG00000139618 or ENSG00000139618.7 with version). ' +
82
+ 'Species is not required for ID lookup.'),
83
+ species: z
84
+ .string()
85
+ .optional()
86
+ .describe('Species in Ensembl internal format: lowercase scientific name with underscores ' +
87
+ '(e.g. homo_sapiens, mus_musculus, danio_rerio). ' +
88
+ 'Required when using symbol. Default is homo_sapiens for symbol-based lookups. ' +
89
+ 'Use ensembl_list_species to discover valid values.'),
90
+ ids: z
91
+ .array(z.string().describe('An Ensembl stable gene or transcript ID to resolve in this batch.'))
92
+ .max(20)
93
+ .optional()
94
+ .describe('Batch lookup: up to 20 Ensembl stable IDs (ENSG…, ENST…). ' +
95
+ 'Returns a succeeded/failed split. Cannot be combined with symbol or id.'),
96
+ symbols: z
97
+ .array(z.string().describe('A gene symbol to resolve in this batch (e.g. BRCA2, TP53).'))
98
+ .max(20)
99
+ .optional()
100
+ .describe('Batch lookup: up to 20 gene symbols. ' +
101
+ 'Requires species to be set. Returns a succeeded/failed split. ' +
102
+ 'Cannot be combined with symbol, id, or ids.'),
103
+ expand_transcripts: z
104
+ .boolean()
105
+ .default(false)
106
+ .describe('When true, include the full transcript list in the response. ' +
107
+ 'Each transcript has its ID, biotype, canonical flag, and coordinates. ' +
108
+ 'Default is false to keep responses compact.'),
109
+ }),
110
+ output: z.object({
111
+ gene: GeneResultSchema.optional().describe('Single gene record. Present for symbol or id lookups.'),
112
+ batch: BatchResultSchema.optional().describe('Batch results. Present for ids or symbols lookups.'),
113
+ }),
114
+ errors: [
115
+ {
116
+ reason: 'not_found',
117
+ code: JsonRpcErrorCode.NotFound,
118
+ when: 'The gene symbol or stable ID was not found in Ensembl.',
119
+ recovery: 'Verify the symbol spelling or ID format. Use ensembl_list_species to confirm the species name, ' +
120
+ 'then retry. Stable IDs are versioned (ENSG00000139618.7) — omitting the version resolves to current.',
121
+ },
122
+ {
123
+ reason: 'invalid_species',
124
+ code: JsonRpcErrorCode.ValidationError,
125
+ when: 'The species string was not recognized by Ensembl.',
126
+ recovery: 'Call ensembl_list_species to discover valid species names. ' +
127
+ 'Species must be in lowercase_underscore format (homo_sapiens, not Human or Homo Sapiens).',
128
+ },
129
+ {
130
+ reason: 'no_input',
131
+ code: JsonRpcErrorCode.InvalidParams,
132
+ when: 'Neither symbol, id, ids, nor symbols was provided.',
133
+ recovery: 'Provide exactly one of: symbol (with species), id, ids array, or symbols array (with species).',
134
+ },
135
+ ],
136
+ async handler(input, ctx) {
137
+ ctx.log.info('Looking up gene', {
138
+ symbol: input.symbol,
139
+ id: input.id,
140
+ species: input.species,
141
+ batchSize: input.ids?.length ?? input.symbols?.length,
142
+ });
143
+ const service = getEnsemblService();
144
+ // --- Batch by IDs ---
145
+ if (input.ids?.length) {
146
+ const map = await service.lookupGenesBatch(input.ids, input.expand_transcripts, ctx);
147
+ const succeeded = Array.from(map.values());
148
+ const resolvedIds = new Set(map.keys());
149
+ const failed = input.ids
150
+ .filter((id) => !resolvedIds.has(id))
151
+ .map((id) => ({ query: id, error: `ID ${id} not found in Ensembl.` }));
152
+ return { batch: { succeeded, failed } };
153
+ }
154
+ // --- Batch by symbols ---
155
+ if (input.symbols?.length) {
156
+ const speciesStr = input.species?.trim() || 'homo_sapiens';
157
+ const map = await service.lookupSymbolsBatch(input.symbols, speciesStr, input.expand_transcripts, ctx);
158
+ const succeeded = Array.from(map.values());
159
+ const resolvedSymbols = new Set(map.keys());
160
+ const failed = input.symbols
161
+ .filter((s) => !resolvedSymbols.has(s))
162
+ .map((s) => ({
163
+ query: s,
164
+ error: `Symbol ${s} not found in Ensembl for species ${speciesStr}.`,
165
+ }));
166
+ return { batch: { succeeded, failed } };
167
+ }
168
+ // --- Single symbol ---
169
+ if (input.symbol?.trim()) {
170
+ const speciesStr = input.species?.trim() || 'homo_sapiens';
171
+ const gene = await service
172
+ .lookupGene(input.symbol.trim(), speciesStr, input.expand_transcripts, ctx)
173
+ .catch((err) => {
174
+ const msg = err instanceof Error ? err.message : String(err);
175
+ if (/not found|no stable id|no results|no valid lookup/i.test(msg)) {
176
+ throw ctx.fail('not_found', `Gene symbol "${input.symbol}" not found in ${speciesStr}.`);
177
+ }
178
+ if (/species|invalid|unrecognized/i.test(msg)) {
179
+ throw ctx.fail('invalid_species', `Species "${speciesStr}" not recognized by Ensembl.`);
180
+ }
181
+ throw err;
182
+ });
183
+ return { gene };
184
+ }
185
+ // --- Single ID ---
186
+ if (input.id?.trim()) {
187
+ const gene = await service
188
+ .lookupGeneById(input.id.trim(), input.expand_transcripts, ctx)
189
+ .catch((err) => {
190
+ const msg = err instanceof Error ? err.message : String(err);
191
+ if (/not found|no stable id/i.test(msg)) {
192
+ throw ctx.fail('not_found', `Gene ID "${input.id}" not found in Ensembl.`);
193
+ }
194
+ throw err;
195
+ });
196
+ return { gene };
197
+ }
198
+ throw ctx.fail('no_input', 'Provide symbol (with species), id, ids, or symbols.');
199
+ },
200
+ format: (result) => {
201
+ const lines = [];
202
+ const renderGene = (g) => {
203
+ lines.push(`## ${g.displayName ?? g.id}`);
204
+ lines.push(`**ID:** ${g.id}`);
205
+ if (g.species)
206
+ lines.push(`**Species:** ${g.species}`);
207
+ if (g.biotype)
208
+ lines.push(`**Biotype:** ${g.biotype}`);
209
+ if (g.description)
210
+ lines.push(`**Description:** ${g.description}`);
211
+ if (g.chromosome)
212
+ lines.push(`**Chromosome:** ${g.chromosome}`);
213
+ if (g.start != null)
214
+ lines.push(`**Start:** ${g.start}`);
215
+ if (g.end != null)
216
+ lines.push(`**End:** ${g.end}`);
217
+ if (g.strand != null)
218
+ lines.push(`**Strand:** ${g.strand} (${g.strand === -1 ? 'reverse' : 'forward'})`);
219
+ if (g.assemblyName)
220
+ lines.push(`**Assembly:** ${g.assemblyName}`);
221
+ if (g.transcripts?.length) {
222
+ lines.push(`\n**Transcripts (${g.transcripts.length}):**`);
223
+ for (const t of g.transcripts) {
224
+ const canon = t.isCanonical ? ' ★ canonical' : '';
225
+ const loc = t.start != null && t.end != null
226
+ ? ` ${t.start}-${t.end}${t.strand != null ? `:${t.strand}` : ''}`
227
+ : '';
228
+ const len = t.lengthInBp != null ? ` ${t.lengthInBp}bp` : '';
229
+ lines.push(`- ${t.id}${t.displayName ? ` (${t.displayName})` : ''}${canon}${t.biotype ? ` [${t.biotype}]` : ''}${loc}${len}`);
230
+ }
231
+ }
232
+ };
233
+ if (result.gene) {
234
+ renderGene(result.gene);
235
+ }
236
+ else if (result.batch) {
237
+ const { succeeded, failed } = result.batch;
238
+ lines.push(`## Batch Lookup Results`);
239
+ lines.push(`**Succeeded:** ${succeeded.length} | **Failed:** ${failed.length}\n`);
240
+ for (const g of succeeded) {
241
+ renderGene(g);
242
+ lines.push('');
243
+ }
244
+ if (failed.length > 0) {
245
+ lines.push('### Failed lookups');
246
+ for (const f of failed) {
247
+ lines.push(`- **${f.query}:** ${f.error}`);
248
+ }
249
+ }
250
+ }
251
+ return [{ type: 'text', text: lines.join('\n') }];
252
+ },
253
+ });
254
+ //# sourceMappingURL=lookup-gene.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup-gene.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/lookup-gene.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAChE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IACvE,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,oEAAoE,CAAC;IACjF,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;IAC7F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;IAC/F,GAAG,EAAE,CA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C,yBAAyB,CAAC,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,kBAAkB,SAAS,CAAC,MAAM,kBAAkB,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;YAClF,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;gBAC1B,UAAU,CAAC,CAAa,CAAC,CAAC;gBAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,CAAC;YACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBACjC,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;oBACvB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @fileoverview Tool to predict functional consequences of sequence variants using Ensembl VEP.
3
+ * @module mcp-server/tools/definitions/predict-variant
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const ensemblPredictVariant: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ variant: z.ZodString;
9
+ species: z.ZodDefault<z.ZodString>;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ results: z.ZodArray<z.ZodObject<{
12
+ input: z.ZodOptional<z.ZodString>;
13
+ chromosome: z.ZodOptional<z.ZodString>;
14
+ start: z.ZodOptional<z.ZodNumber>;
15
+ end: z.ZodOptional<z.ZodNumber>;
16
+ assemblyName: z.ZodOptional<z.ZodString>;
17
+ mostSevereConsequence: z.ZodOptional<z.ZodString>;
18
+ transcriptConsequences: z.ZodArray<z.ZodObject<{
19
+ transcriptId: z.ZodOptional<z.ZodString>;
20
+ geneId: z.ZodOptional<z.ZodString>;
21
+ geneSymbol: z.ZodOptional<z.ZodString>;
22
+ consequenceTerms: z.ZodArray<z.ZodString>;
23
+ impact: z.ZodOptional<z.ZodString>;
24
+ biotype: z.ZodOptional<z.ZodString>;
25
+ hgvsc: z.ZodOptional<z.ZodString>;
26
+ hgvsp: z.ZodOptional<z.ZodString>;
27
+ aminoAcids: z.ZodOptional<z.ZodString>;
28
+ sift: z.ZodOptional<z.ZodObject<{
29
+ prediction: z.ZodString;
30
+ score: z.ZodNumber;
31
+ }, z.core.$strip>>;
32
+ polyphen: z.ZodOptional<z.ZodObject<{
33
+ prediction: z.ZodString;
34
+ score: z.ZodNumber;
35
+ }, z.core.$strip>>;
36
+ }, z.core.$strip>>;
37
+ colocatedVariants: z.ZodArray<z.ZodObject<{
38
+ id: z.ZodOptional<z.ZodString>;
39
+ alleleString: z.ZodOptional<z.ZodString>;
40
+ clinicalSignificance: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ pubmed: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
42
+ }, z.core.$strip>>;
43
+ }, z.core.$strip>>;
44
+ totalCount: z.ZodNumber;
45
+ }, z.core.$strip>, readonly [{
46
+ readonly reason: "invalid_notation";
47
+ readonly code: JsonRpcErrorCode.ValidationError;
48
+ readonly when: "The variant notation is malformed or cannot be parsed by VEP.";
49
+ readonly recovery: string;
50
+ }, {
51
+ readonly reason: "not_found";
52
+ readonly code: JsonRpcErrorCode.NotFound;
53
+ readonly when: "The variant location falls outside any known transcript or assembly region.";
54
+ readonly recovery: string;
55
+ }], {
56
+ readonly notice: z.ZodOptional<z.ZodString>;
57
+ }>;
58
+ //# sourceMappingURL=predict-variant.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predict-variant.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/predict-variant.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA6GjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwMhC,CAAC"}