@cyanheads/ensembl-mcp-server 0.4.0 → 0.4.2
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.
- package/AGENTS.md +2 -2
- package/CLAUDE.md +2 -2
- package/Dockerfile +10 -6
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/changelog/0.4.x/0.4.1.md +30 -0
- package/changelog/0.4.x/0.4.2.md +19 -0
- package/changelog/template.md +5 -3
- package/dist/mcp-server/resources/definitions/gene.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/gene.resource.js +3 -1
- package/dist/mcp-server/resources/definitions/gene.resource.js.map +1 -1
- package/dist/mcp-server/resources/definitions/transcript.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/transcript.resource.js +3 -1
- package/dist/mcp-server/resources/definitions/transcript.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-homology.tool.d.ts +4 -0
- package/dist/mcp-server/tools/definitions/get-homology.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-homology.tool.js +52 -12
- package/dist/mcp-server/tools/definitions/get-homology.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-sequence.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-sequence.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-sequence.tool.js +42 -24
- package/dist/mcp-server/tools/definitions/get-sequence.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-xrefs.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-xrefs.tool.js +3 -1
- package/dist/mcp-server/tools/definitions/get-xrefs.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/lookup-gene.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/lookup-gene.tool.js +13 -5
- package/dist/mcp-server/tools/definitions/lookup-gene.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/predict-variant.tool.d.ts +8 -0
- package/dist/mcp-server/tools/definitions/predict-variant.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/predict-variant.tool.js +138 -16
- package/dist/mcp-server/tools/definitions/predict-variant.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/query-region.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/query-region.tool.js +6 -2
- package/dist/mcp-server/tools/definitions/query-region.tool.js.map +1 -1
- package/dist/services/ensembl/ensembl-service.d.ts +1 -1
- package/dist/services/ensembl/ensembl-service.d.ts.map +1 -1
- package/dist/services/ensembl/ensembl-service.js +11 -2
- package/dist/services/ensembl/ensembl-service.js.map +1 -1
- package/package.json +9 -7
- package/server.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** ensembl-mcp-server
|
|
4
|
-
**Version:** 0.4.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.10.
|
|
4
|
+
**Version:** 0.4.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.10.14`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
|
|
8
8
|
**Zod:** ^4.4.3
|
package/CLAUDE.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** ensembl-mcp-server
|
|
4
|
-
**Version:** 0.4.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.10.
|
|
4
|
+
**Version:** 0.4.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.10.14`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
|
|
8
8
|
**Zod:** ^4.4.3
|
package/Dockerfile
CHANGED
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
# This stage installs all dependencies (including dev), builds the TypeScript
|
|
5
5
|
# source code into JavaScript, and prepares the production assets.
|
|
6
6
|
# ==============================================================================
|
|
7
|
-
FROM oven/bun:1.3 AS build
|
|
7
|
+
FROM oven/bun:1.3.14 AS build
|
|
8
8
|
|
|
9
9
|
WORKDIR /usr/src/app
|
|
10
10
|
|
|
11
11
|
# Copy dependency manifests for optimized layer caching
|
|
12
12
|
COPY package.json bun.lock ./
|
|
13
13
|
|
|
14
|
-
# Install all dependencies (including dev dependencies for building)
|
|
15
|
-
|
|
14
|
+
# Install all dependencies (including dev dependencies for building).
|
|
15
|
+
# The BuildKit cache mount persists Bun's global package cache across builds.
|
|
16
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
17
|
+
bun install --frozen-lockfile --ignore-scripts
|
|
16
18
|
|
|
17
19
|
# Copy the rest of the source code
|
|
18
20
|
COPY . .
|
|
@@ -28,7 +30,7 @@ RUN bun run build
|
|
|
28
30
|
# application. It uses a slim base image and only includes production
|
|
29
31
|
# dependencies and build artifacts.
|
|
30
32
|
# ==============================================================================
|
|
31
|
-
FROM oven/bun:1.3-slim AS production
|
|
33
|
+
FROM oven/bun:1.3.14-slim AS production
|
|
32
34
|
|
|
33
35
|
WORKDIR /usr/src/app
|
|
34
36
|
|
|
@@ -49,13 +51,15 @@ COPY package.json bun.lock ./
|
|
|
49
51
|
|
|
50
52
|
# Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
|
|
51
53
|
# that are not needed in the final production image.
|
|
52
|
-
RUN bun
|
|
54
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
55
|
+
bun install --production --frozen-lockfile --ignore-scripts
|
|
53
56
|
|
|
54
57
|
# Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
|
|
55
58
|
# These are not bundled by default to keep the base image lean. Enable at build time
|
|
56
59
|
# with: docker build --build-arg OTEL_ENABLED=true
|
|
57
60
|
ARG OTEL_ENABLED=true
|
|
58
|
-
RUN
|
|
61
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
62
|
+
if [ "$OTEL_ENABLED" = "true" ]; then \
|
|
59
63
|
bun add @hono/otel \
|
|
60
64
|
@opentelemetry/instrumentation-http \
|
|
61
65
|
@opentelemetry/exporter-metrics-otlp-http \
|
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@ Apache License
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2026 Casey Hand @cyanheads
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/ensembl-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/ensembl-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -235,7 +235,7 @@ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
|
|
|
235
235
|
|
|
236
236
|
### Prerequisites
|
|
237
237
|
|
|
238
|
-
- [Bun v1.3.
|
|
238
|
+
- [Bun v1.3.14](https://bun.sh/) or higher (or Node.js v24+).
|
|
239
239
|
- No API key required — Ensembl REST is fully public.
|
|
240
240
|
|
|
241
241
|
### Installation
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "ensembl_get_sequence forwards expand_5prime/expand_3prime to stable-ID genomic lookups and accepts a bare chr:start-end region when species is set; mcp-ts-core 0.10.10 → 0.10.14 with a Bun supply-chain guard and Dockerfile hardening"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.4.1 — 2026-07-09
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`ensembl_get_sequence` accepts a bare `chr:start-end` region when `species` is set** — alongside the existing `species:chr:start-end` form, so region-mode input chains directly from `ensembl_lookup_gene`/`ensembl_query_region` coordinates without repackaging into a server-specific string. A bare region given without `species` throws the new `missing_species` `ValidationError`. ([#14](https://github.com/cyanheads/ensembl-mcp-server/issues/14))
|
|
12
|
+
|
|
13
|
+
## Changed
|
|
14
|
+
|
|
15
|
+
- **`@cyanheads/mcp-ts-core` maintenance adoption** — 12 skills re-synced to the current framework set; see Dependencies for the version arrow.
|
|
16
|
+
- **Supply-chain guard** — `bunfig.toml` sets `install.minimumReleaseAge` (3 days, `@cyanheads/mcp-ts-core` excluded) and `install.security.scanner = "@socketsecurity/bun-security-scanner"`.
|
|
17
|
+
- **`devcheck.config.json`** outdated-package allowlist adds `@socketsecurity/bun-security-scanner`; `scripts/devcheck.ts`'s outdated check also skips any package held back by the `minimumReleaseAge` guard instead of flagging it as unexpected.
|
|
18
|
+
- **`Dockerfile`** pins `oven/bun:1.3.14` (was floating `1.3`), adds BuildKit cache mounts to both install stages, and runs the build-stage install with `--ignore-scripts`.
|
|
19
|
+
- **`.github/SECURITY.md`** and **`.gitattributes`** added; **`LICENSE`** copyright year 2025 → 2026.
|
|
20
|
+
|
|
21
|
+
## Fixed
|
|
22
|
+
|
|
23
|
+
- **`ensembl_get_sequence` stable-ID genomic lookups now forward `expand_5prime`/`expand_3prime`** — previously only region-mode requests received these params, so a stable-ID call returned the same sequence length regardless of the requested expansion. `EnsemblService.getSequenceById` now accepts both params and gates them to `type=genomic` (Ensembl ignores them for cdna/cds/protein). ([#13](https://github.com/cyanheads/ensembl-mcp-server/issues/13))
|
|
24
|
+
|
|
25
|
+
## Dependencies
|
|
26
|
+
|
|
27
|
+
- `@cyanheads/mcp-ts-core` `^0.10.10` → `^0.10.14`
|
|
28
|
+
- `tsc-alias` `^1.8.17` → `^1.9.0`
|
|
29
|
+
- `vitest` `^4.1.9` → `^4.1.10`
|
|
30
|
+
- `@socketsecurity/bun-security-scanner` `^1.1.2` added
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "ensembl_predict_variant and ensembl_get_homology cap high-cardinality output (transcript consequences, PubMed IDs, homologs) by default with truthful totals and an uncap escape hatch; every declared ctx.fail site now surfaces a recovery hint"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.4.2 — 2026-07-09
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`ensembl_predict_variant`** gains `max_transcript_consequences` (default `10`, sentinel `0` = uncapped) and `max_pubmed_ids_per_variant` (default `10`, sentinel `0` = uncapped) input params, plus `include_all_colocated_pubmed` (default `false`) to bypass the PubMed cap regardless of the limit. Each VEP record gains output field `transcriptConsequencesTotal`; each colocated variant gains `pubmedTotal` — both report the true pre-cap count. ([#15](https://github.com/cyanheads/ensembl-mcp-server/issues/15))
|
|
12
|
+
- **`ensembl_get_homology`** gains `max_results` (default `25`, sentinel `0` = uncapped). ([#15](https://github.com/cyanheads/ensembl-mcp-server/issues/15))
|
|
13
|
+
- **`enrichment.truncated`/`shown`/`cap`** fields added to `ensembl_predict_variant` and `ensembl_get_homology` output, populated whenever a cap trims the response.
|
|
14
|
+
- **Every declared `ctx.fail` site** across 8 tool/resource files (24 call sites — `ensembl_predict_variant`, `ensembl_get_homology`, `ensembl_get_sequence`, `ensembl_get_xrefs`, `ensembl_lookup_gene`, `ensembl_query_region`, and the `gene`/`transcript` resources) now passes `{ ...ctx.recoveryFor(reason) }`, surfacing the tool's declared `recovery` guidance onto `data.recovery.hint` (mirrored into `content[0].text` as `Recovery: …`). ([#16](https://github.com/cyanheads/ensembl-mcp-server/issues/16))
|
|
15
|
+
|
|
16
|
+
## Changed
|
|
17
|
+
|
|
18
|
+
- **Default output for `ensembl_predict_variant` and `ensembl_get_homology` is now capped** — transcript consequences, per-variant PubMed IDs, and homolog lists trim to their defaults instead of returning every match. A single composed `enrichment.notice` discloses what was omitted and how to retrieve the rest (raise the cap, or set it to `0` / `include_all_colocated_pubmed=true` for the full set).
|
|
19
|
+
- **`ensembl_get_homology`'s `totalCount`** now reports the true available homolog count rather than the returned page length — it can exceed `homologs.length` when the result was capped. ([#15](https://github.com/cyanheads/ensembl-mcp-server/issues/15))
|
package/changelog/template.md
CHANGED
|
@@ -15,9 +15,11 @@ summary: ""
|
|
|
15
15
|
# usage. Flagged as `Breaking` in the rollup.
|
|
16
16
|
breaking: false
|
|
17
17
|
|
|
18
|
-
# Set `true`
|
|
19
|
-
#
|
|
20
|
-
#
|
|
18
|
+
# Set `true` ONLY for a security fix in THIS project's own source code — a
|
|
19
|
+
# vulnerability or hardening in code you ship. A dependency or transitive CVE
|
|
20
|
+
# bump is routine maintenance, NOT a security release: record it under
|
|
21
|
+
# `## Dependencies` (with the advisory ID) and leave this `false`. When true,
|
|
22
|
+
# pairs with the `## Security` section below and flags `Security` in the rollup.
|
|
21
23
|
security: false
|
|
22
24
|
|
|
23
25
|
# Optional free-form notes for maintenance agents processing this release.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gene.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/gene.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,mBAAmB;;;;;;;
|
|
1
|
+
{"version":3,"file":"gene.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/gene.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,mBAAmB;;;;;;;GA6D9B,CAAC"}
|
|
@@ -33,7 +33,9 @@ export const ensemblGeneResource = resource('ensembl://gene/{id}', {
|
|
|
33
33
|
const gene = await service.lookupGeneById(params.id, true, ctx).catch((err) => {
|
|
34
34
|
const msg = err instanceof Error ? err.message : String(err);
|
|
35
35
|
if (/not found/i.test(msg)) {
|
|
36
|
-
throw ctx.fail('not_found', `Gene ${params.id} not found in Ensembl
|
|
36
|
+
throw ctx.fail('not_found', `Gene ${params.id} not found in Ensembl.`, {
|
|
37
|
+
...ctx.recoveryFor('not_found'),
|
|
38
|
+
});
|
|
37
39
|
}
|
|
38
40
|
throw err;
|
|
39
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gene.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/gene.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,qBAAqB,EAAE;IACjE,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,yGAAyG;QACzG,uDAAuD;QACvD,0EAA0E;IAC5E,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,QAAQ,CACP,kCAAkC;YAChC,4EAA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,EAAE;YACT;gBACE,GAAG,EAAE,gCAAgC;gBACrC,IAAI,EAAE,sBAAsB;gBAC5B,WAAW,EAAE,kDAAkD;gBAC/D,QAAQ,EAAE,kBAAkB;aAC7B;YACD;gBACE,GAAG,EAAE,gCAAgC;gBACrC,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EAAE,4BAA4B;gBACzC,QAAQ,EAAE,kBAAkB;aAC7B;SACF;KACF,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/transcript.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,yBAAyB;;;;;;;
|
|
1
|
+
{"version":3,"file":"transcript.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/transcript.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,yBAAyB;;;;;;;GAuDpC,CAAC"}
|
|
@@ -33,7 +33,9 @@ export const ensemblTranscriptResource = resource('ensembl://transcript/{id}', {
|
|
|
33
33
|
const transcript = await service.lookupTranscript(params.id, ctx).catch((err) => {
|
|
34
34
|
const msg = err instanceof Error ? err.message : String(err);
|
|
35
35
|
if (/not found/i.test(msg)) {
|
|
36
|
-
throw ctx.fail('not_found', `Transcript ${params.id} not found in Ensembl
|
|
36
|
+
throw ctx.fail('not_found', `Transcript ${params.id} not found in Ensembl.`, {
|
|
37
|
+
...ctx.recoveryFor('not_found'),
|
|
38
|
+
});
|
|
37
39
|
}
|
|
38
40
|
throw err;
|
|
39
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/transcript.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC,2BAA2B,EAAE;IAC7E,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,0FAA0F;QAC1F,+FAA+F;QAC/F,2FAA2F;IAC7F,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,QAAQ,CACP,wCAAwC;YACtC,4EAA4E;YAC5E,+CAA+C,CAClD;KACJ,CAAC;IAEF,MAAM,EAAE;QACN;YACE,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,IAAI,EAAE,oDAAoD;YAC1D,QAAQ,EACN,+EAA+E;gBAC/E,6EAA6E;SAChF;KACF;IAED,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,8BAA8B,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;QAEpC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;YACvF,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3B,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,MAAM,CAAC,EAAE,wBAAwB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"transcript.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/transcript.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC,2BAA2B,EAAE;IAC7E,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,0FAA0F;QAC1F,+FAA+F;QAC/F,2FAA2F;IAC7F,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,QAAQ,CACP,wCAAwC;YACtC,4EAA4E;YAC5E,+CAA+C,CAClD;KACJ,CAAC;IAEF,MAAM,EAAE;QACN;YACE,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,IAAI,EAAE,oDAAoD;YAC1D,QAAQ,EACN,+EAA+E;gBAC/E,6EAA6E;SAChF;KACF;IAED,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,8BAA8B,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;QAEpC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;YACvF,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3B,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,MAAM,CAAC,EAAE,wBAAwB,EAAE;oBAC3E,GAAG,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC;iBAChC,CAAC,CAAC;YACL,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QACjB,SAAS,EAAE;YACT;gBACE,GAAG,EAAE,sCAAsC;gBAC3C,IAAI,EAAE,+CAA+C;gBACrD,WAAW,EAAE,qCAAqC;gBAClD,QAAQ,EAAE,kBAAkB;aAC7B;SACF;KACF,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -14,6 +14,7 @@ export declare const ensemblGetHomology: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
14
14
|
paralogues: "paralogues";
|
|
15
15
|
all: "all";
|
|
16
16
|
}>>;
|
|
17
|
+
max_results: z.ZodDefault<z.ZodNumber>;
|
|
17
18
|
}, z.core.$strip>, z.ZodObject<{
|
|
18
19
|
homologs: z.ZodArray<z.ZodObject<{
|
|
19
20
|
targetId: z.ZodString;
|
|
@@ -44,5 +45,8 @@ export declare const ensemblGetHomology: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
44
45
|
readonly recovery: "Provide exactly one: a gene symbol (with optional species) or a stable Ensembl gene ID.";
|
|
45
46
|
}], {
|
|
46
47
|
readonly notice: z.ZodOptional<z.ZodString>;
|
|
48
|
+
readonly truncated: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
readonly shown: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
readonly cap: z.ZodOptional<z.ZodNumber>;
|
|
47
51
|
}>;
|
|
48
52
|
//# sourceMappingURL=get-homology.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-homology.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-homology.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA0CjE,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"get-homology.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-homology.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA0CjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkP7B,CAAC"}
|
|
@@ -73,18 +73,40 @@ export const ensemblGetHomology = tool('ensembl_get_homology', {
|
|
|
73
73
|
'orthologues: genes related by speciation (cross-species equivalents). ' +
|
|
74
74
|
'paralogues: genes related by duplication (within or across species). ' +
|
|
75
75
|
'all: both orthologs and paralogs.'),
|
|
76
|
+
max_results: z
|
|
77
|
+
.number()
|
|
78
|
+
.int()
|
|
79
|
+
.min(0)
|
|
80
|
+
.default(25)
|
|
81
|
+
.describe('Maximum number of homologs to return. Broad orthology queries ' +
|
|
82
|
+
'(e.g. BRCA2 across all species) can return 150+ homologs; the default keeps ' +
|
|
83
|
+
'responses focused. Set to 0 to return every homolog uncapped. ' +
|
|
84
|
+
'totalCount always reports the true number available before this cap.'),
|
|
76
85
|
}),
|
|
77
86
|
output: z.object({
|
|
78
87
|
homologs: z
|
|
79
88
|
.array(HomologyEntrySchema.describe('A single homologous gene with its stable ID, species, homology type, and sequence identity metrics.'))
|
|
80
|
-
.describe('Homologous genes found for the query gene.'
|
|
81
|
-
|
|
89
|
+
.describe('Homologous genes found for the query gene, capped to max_results. ' +
|
|
90
|
+
'totalCount reports the full count available before the cap.'),
|
|
91
|
+
totalCount: z
|
|
92
|
+
.number()
|
|
93
|
+
.describe('Total number of homologs available before the max_results cap. ' +
|
|
94
|
+
'Exceeds the returned homologs count when the list was capped.'),
|
|
82
95
|
queryId: z.string().describe('The resolved Ensembl gene ID used for the homology query.'),
|
|
83
96
|
querySpecies: z.string().describe('The source species used for the query.'),
|
|
84
97
|
queryType: z.string().describe('The homology type queried (orthologues, paralogues, or all).'),
|
|
85
98
|
}),
|
|
86
99
|
enrichment: {
|
|
87
|
-
notice: z
|
|
100
|
+
notice: z
|
|
101
|
+
.string()
|
|
102
|
+
.optional()
|
|
103
|
+
.describe('Guidance when no homologs are found or the list was capped.'),
|
|
104
|
+
truncated: z
|
|
105
|
+
.boolean()
|
|
106
|
+
.optional()
|
|
107
|
+
.describe('True when the homolog list was capped at max_results.'),
|
|
108
|
+
shown: z.number().optional().describe('Number of homologs returned after the max_results cap.'),
|
|
109
|
+
cap: z.number().optional().describe('The max_results limit applied to the homolog list.'),
|
|
88
110
|
},
|
|
89
111
|
errors: [
|
|
90
112
|
{
|
|
@@ -117,10 +139,12 @@ export const ensemblGetHomology = tool('ensembl_get_homology', {
|
|
|
117
139
|
});
|
|
118
140
|
const service = getEnsemblService();
|
|
119
141
|
if (!input.symbol?.trim() && !input.id?.trim()) {
|
|
120
|
-
throw ctx.fail('no_input', 'Provide either symbol (with species) or a stable gene ID.'
|
|
142
|
+
throw ctx.fail('no_input', 'Provide either symbol (with species) or a stable gene ID.', {
|
|
143
|
+
...ctx.recoveryFor('no_input'),
|
|
144
|
+
});
|
|
121
145
|
}
|
|
122
146
|
if (input.id?.trim() && input.symbol?.trim()) {
|
|
123
|
-
throw ctx.fail('conflicting_input', 'Provide either symbol or id, not both — they may resolve to different genes.');
|
|
147
|
+
throw ctx.fail('conflicting_input', 'Provide either symbol or id, not both — they may resolve to different genes.', { ...ctx.recoveryFor('conflicting_input') });
|
|
124
148
|
}
|
|
125
149
|
const idTrimmed = input.id?.trim();
|
|
126
150
|
const symbolTrimmed = input.symbol?.trim();
|
|
@@ -132,7 +156,9 @@ export const ensemblGetHomology = tool('ensembl_get_homology', {
|
|
|
132
156
|
.catch((err) => {
|
|
133
157
|
const msg = err instanceof Error ? err.message : String(err);
|
|
134
158
|
if (/not found|no valid lookup|page not found/i.test(msg)) {
|
|
135
|
-
throw ctx.fail('not_found', `Gene ID "${idTrimmed}" not found in Ensembl
|
|
159
|
+
throw ctx.fail('not_found', `Gene ID "${idTrimmed}" not found in Ensembl.`, {
|
|
160
|
+
...ctx.recoveryFor('not_found'),
|
|
161
|
+
});
|
|
136
162
|
}
|
|
137
163
|
throw err;
|
|
138
164
|
});
|
|
@@ -148,7 +174,7 @@ export const ensemblGetHomology = tool('ensembl_get_homology', {
|
|
|
148
174
|
const msg = err instanceof Error ? err.message : String(err);
|
|
149
175
|
// Ensembl returns {"error":"<species_name>"} for invalid gene symbols in homology endpoint
|
|
150
176
|
if (/not found|no valid lookup/i.test(msg) || msg === input.species) {
|
|
151
|
-
throw ctx.fail('not_found', `Gene symbol "${submittedSymbol}" not found in ${input.species}
|
|
177
|
+
throw ctx.fail('not_found', `Gene symbol "${submittedSymbol}" not found in ${input.species}.`, { ...ctx.recoveryFor('not_found') });
|
|
152
178
|
}
|
|
153
179
|
throw err;
|
|
154
180
|
});
|
|
@@ -157,15 +183,27 @@ export const ensemblGetHomology = tool('ensembl_get_homology', {
|
|
|
157
183
|
// fall back to the submitted symbol only when the response carried no data entry.
|
|
158
184
|
queryId = result.resolvedQueryId ?? submittedSymbol;
|
|
159
185
|
}
|
|
160
|
-
|
|
186
|
+
// Ensembl returns the full homolog set; cap post-fetch so broad orthology
|
|
187
|
+
// queries stay compact by default. totalCount stays the true available count
|
|
188
|
+
// so a caller is never misled about completeness (max_results = 0 disables).
|
|
189
|
+
const availableCount = homologs.length;
|
|
190
|
+
const returned = input.max_results > 0 ? homologs.slice(0, input.max_results) : homologs;
|
|
191
|
+
if (returned.length === 0) {
|
|
161
192
|
ctx.enrich.notice(`No ${input.type} found for "${queryId}" in ${input.species}` +
|
|
162
193
|
(input.target_species ? ` targeting ${input.target_species}` : '') +
|
|
163
194
|
'. Try type=all or remove the target_species filter.');
|
|
164
195
|
}
|
|
165
|
-
|
|
196
|
+
else if (returned.length < availableCount) {
|
|
197
|
+
ctx.enrich.truncated({
|
|
198
|
+
shown: returned.length,
|
|
199
|
+
cap: input.max_results,
|
|
200
|
+
guidance: `Showing ${returned.length} of ${availableCount} homologs. ` +
|
|
201
|
+
'Raise max_results (0 returns all) or set target_species to narrow to one species.',
|
|
202
|
+
});
|
|
203
|
+
}
|
|
166
204
|
return {
|
|
167
|
-
homologs,
|
|
168
|
-
totalCount:
|
|
205
|
+
homologs: returned,
|
|
206
|
+
totalCount: availableCount,
|
|
169
207
|
queryId,
|
|
170
208
|
querySpecies: input.species,
|
|
171
209
|
queryType: input.type,
|
|
@@ -174,7 +212,9 @@ export const ensemblGetHomology = tool('ensembl_get_homology', {
|
|
|
174
212
|
format: (result) => {
|
|
175
213
|
const lines = [];
|
|
176
214
|
lines.push(`## Homologs of ${result.queryId} (${result.querySpecies})`);
|
|
177
|
-
|
|
215
|
+
const shown = result.homologs.length;
|
|
216
|
+
const foundLabel = result.totalCount > shown ? `${shown} of ${result.totalCount}` : `${result.totalCount}`;
|
|
217
|
+
lines.push(`**Type:** ${result.queryType} | **Found:** ${foundLabel}\n`);
|
|
178
218
|
if (result.homologs.length === 0) {
|
|
179
219
|
lines.push('No homologs found. Try type=all or remove the target_species filter.');
|
|
180
220
|
return [{ type: 'text', text: lines.join('\n') }];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-homology.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-homology.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;AAG1E,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAErE,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;IAChG,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,gEAAgE,CAAC;IAC7E,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,0EAA0E;QACxE,wDAAwD,CAC3D;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,wEAAwE;QACtE,kDAAkD,CACrD;IACH,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,iEAAiE;QAC/D,oEAAoE,CACvE;IACH,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,sEAAsE;QACpE,wCAAwC,CAC3C;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,sBAAsB,EAAE;IAC7D,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EACT,sGAAsG;QACtG,4GAA4G;QAC5G,wGAAwG;QACxG,6FAA6F;QAC7F,0GAA0G;QAC1G,gDAAgD;IAClD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,wDAAwD;YACtD,qEAAqE;YACrE,6BAA6B,CAChC;QACH,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,iDAAiD;YAC/C,8DAA8D;YAC9D,iCAAiC,CACpC;QACH,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,OAAO,CAAC,cAAc,CAAC;aACvB,QAAQ,CACP,qFAAqF;YACnF,6EAA6E,CAChF;QACH,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,+EAA+E;YAC7E,wDAAwD;YACxD,oDAAoD,CACvD;QACH,IAAI,EAAE,CAAC;aACJ,IAAI,CAAC,cAAc,CAAC;aACpB,OAAO,CAAC,aAAa,CAAC;aACtB,QAAQ,CACP,8BAA8B;YAC5B,wEAAwE;YACxE,uEAAuE;YACvE,mCAAmC,CACtC;KACJ,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,CAAC;aACR,KAAK,CACJ,mBAAmB,CAAC,QAAQ,CAC1B,qGAAqG,CACtG,CACF;aACA,QAAQ,
|
|
1
|
+
{"version":3,"file":"get-homology.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-homology.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;AAG1E,MAAM,cA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ensemblGetSequence: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
31
31
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
32
32
|
readonly when: "The requested sequence type is incompatible with the provided ID type.";
|
|
33
33
|
readonly recovery: string;
|
|
34
|
+
}, {
|
|
35
|
+
readonly reason: "missing_species";
|
|
36
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
37
|
+
readonly when: "A bare chr:start-end region was given without a species.";
|
|
38
|
+
readonly recovery: string;
|
|
34
39
|
}], undefined>;
|
|
35
40
|
//# sourceMappingURL=get-sequence.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sequence.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-sequence.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"get-sequence.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-sequence.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoM7B,CAAC"}
|
|
@@ -12,17 +12,18 @@ export const ensemblGetSequence = tool('ensembl_get_sequence', {
|
|
|
12
12
|
'Returns the sequence with its stable ID, molecule type, and character count — large sequences are ' +
|
|
13
13
|
'returned in full but the length is stated so callers can budget context. The type parameter selects ' +
|
|
14
14
|
'which sequence is fetched: genomic (default, includes introns), cdna (spliced transcript), ' +
|
|
15
|
-
'cds (coding sequence only), protein. For region mode, set id to
|
|
16
|
-
'(e.g. homo_sapiens:13:32315086-32400268)
|
|
15
|
+
'cds (coding sequence only), protein. For region mode, set id to a region — either ' +
|
|
16
|
+
'species:chr:start-end (e.g. homo_sapiens:13:32315086-32400268) or a bare chr:start-end with ' +
|
|
17
|
+
'species set (e.g. id 13:32315086-32400268, species homo_sapiens). Protein sequences require a transcript or ' +
|
|
17
18
|
'protein stable ID (ENST…/ENSP…), not a gene ID — use ensembl_lookup_gene with expand_transcripts=true ' +
|
|
18
19
|
'to get the canonical transcript ID first.',
|
|
19
20
|
annotations: { readOnlyHint: true, openWorldHint: true, idempotentHint: true },
|
|
20
21
|
input: z.object({
|
|
21
22
|
id: z
|
|
22
23
|
.string()
|
|
23
|
-
.describe('Ensembl stable ID (ENSG…, ENST…, ENSP…) or region
|
|
24
|
-
'species:chr:start-end (e.g. homo_sapiens:13:32315086-32400268)
|
|
25
|
-
'
|
|
24
|
+
.describe('Ensembl stable ID (ENSG…, ENST…, ENSP…) or a genomic region for region mode. ' +
|
|
25
|
+
'Region accepts species:chr:start-end (e.g. homo_sapiens:13:32315086-32400268) or a bare ' +
|
|
26
|
+
'chr:start-end (e.g. 13:32315086-32400268) when the species field is set.'),
|
|
26
27
|
type: z
|
|
27
28
|
.enum(SEQUENCE_TYPES)
|
|
28
29
|
.default('genomic')
|
|
@@ -35,7 +36,8 @@ export const ensemblGetSequence = tool('ensembl_get_sequence', {
|
|
|
35
36
|
.string()
|
|
36
37
|
.optional()
|
|
37
38
|
.describe('Species in Ensembl internal format (e.g. homo_sapiens). ' +
|
|
38
|
-
'Required for
|
|
39
|
+
'Required for a bare chr:start-end region; optional for the species:chr:start-end form ' +
|
|
40
|
+
'(the embedded species is used when the field is omitted). ' +
|
|
39
41
|
'Optional for stable ID lookups — Ensembl infers species from the ID prefix.'),
|
|
40
42
|
expand_5prime: z
|
|
41
43
|
.number()
|
|
@@ -82,30 +84,44 @@ export const ensemblGetSequence = tool('ensembl_get_sequence', {
|
|
|
82
84
|
'Use ensembl_lookup_gene with expand_transcripts=true to find the canonical transcript ID, ' +
|
|
83
85
|
'then request the protein or cds sequence from that transcript ID.',
|
|
84
86
|
},
|
|
87
|
+
{
|
|
88
|
+
reason: 'missing_species',
|
|
89
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
90
|
+
when: 'A bare chr:start-end region was given without a species.',
|
|
91
|
+
recovery: 'Set species (e.g. homo_sapiens) alongside the chr:start-end region, ' +
|
|
92
|
+
'or use the combined species:chr:start-end id form.',
|
|
93
|
+
},
|
|
85
94
|
],
|
|
86
95
|
async handler(input, ctx) {
|
|
87
96
|
ctx.log.info('Fetching sequence', { id: input.id, type: input.type });
|
|
88
97
|
const service = getEnsemblService();
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
// Region mode accepts two id shapes:
|
|
99
|
+
// species:chr:start-end embedded species (e.g. homo_sapiens:13:32315086-32400268)
|
|
100
|
+
// chr:start-end bare region — the species field supplies the species
|
|
101
|
+
// Scaffold/patch names carry dots (e.g. GL000220.1), so the chromosome segment
|
|
102
|
+
// allows "." alongside word characters. Colon count is the discriminant: the two
|
|
103
|
+
// patterns are mutually exclusive (2 colons vs. 1), and a stable ID (ENSG…, no
|
|
104
|
+
// colon) matches neither, routing to stable-ID mode below.
|
|
105
|
+
const isPrefixedRegion = /^[a-z_]+:[\w.]+:\d+-\d+$/i.test(input.id);
|
|
106
|
+
const isBareRegion = /^[\w.]+:\d+-\d+$/.test(input.id);
|
|
107
|
+
if (isPrefixedRegion || isBareRegion) {
|
|
108
|
+
// For the prefixed form the species is the segment before the first colon and
|
|
109
|
+
// the region is everything after it; the bare form takes its species from the
|
|
110
|
+
// species field and uses the whole id as the region.
|
|
111
|
+
const firstColon = input.id.indexOf(':');
|
|
112
|
+
const species = input.species?.trim() || (isPrefixedRegion ? input.id.slice(0, firstColon) : undefined);
|
|
113
|
+
const region = isPrefixedRegion ? input.id.slice(firstColon + 1) : input.id;
|
|
114
|
+
if (!species) {
|
|
115
|
+
throw ctx.fail('missing_species', `Region ${input.id} needs a species — set species (e.g. homo_sapiens) or use the species:chr:start-end id form.`, { ...ctx.recoveryFor('missing_species') });
|
|
99
116
|
}
|
|
100
|
-
const [speciesFromId, chr, range] = parts;
|
|
101
|
-
const speciesStr = input.species?.trim() || speciesFromId;
|
|
102
|
-
const region = `${chr}:${range}`;
|
|
103
117
|
const seq = await service
|
|
104
|
-
.getSequenceByRegion(
|
|
118
|
+
.getSequenceByRegion(species, region, input.expand_5prime, input.expand_3prime, ctx)
|
|
105
119
|
.catch((err) => {
|
|
106
120
|
const msg = err instanceof Error ? err.message : String(err);
|
|
107
121
|
if (/not found|invalid|no stable id/i.test(msg)) {
|
|
108
|
-
throw ctx.fail('not_found', `Region ${input.id} not found: ${msg}
|
|
122
|
+
throw ctx.fail('not_found', `Region ${input.id} not found: ${msg}`, {
|
|
123
|
+
...ctx.recoveryFor('not_found'),
|
|
124
|
+
});
|
|
109
125
|
}
|
|
110
126
|
throw err;
|
|
111
127
|
});
|
|
@@ -113,17 +129,19 @@ export const ensemblGetSequence = tool('ensembl_get_sequence', {
|
|
|
113
129
|
}
|
|
114
130
|
// Stable ID mode
|
|
115
131
|
const seq = await service
|
|
116
|
-
.getSequenceById(input.id.trim(), input.type, ctx)
|
|
132
|
+
.getSequenceById(input.id.trim(), input.type, input.expand_5prime, input.expand_3prime, ctx)
|
|
117
133
|
.catch((err) => {
|
|
118
134
|
const msg = err instanceof Error ? err.message : String(err);
|
|
119
135
|
if (/protein.*gene|cds.*gene|type.*mismatch|incompatible/i.test(msg) ||
|
|
120
136
|
/requesting a gene and type not equal/i.test(msg) ||
|
|
121
137
|
/multiple sequences detected/i.test(msg)) {
|
|
122
138
|
throw ctx.fail('type_mismatch', `Cannot request type "${input.type}" from a gene ID — use a transcript or protein stable ID instead. ` +
|
|
123
|
-
`Call ensembl_lookup_gene with expand_transcripts=true to get transcript IDs
|
|
139
|
+
`Call ensembl_lookup_gene with expand_transcripts=true to get transcript IDs.`, { ...ctx.recoveryFor('type_mismatch') });
|
|
124
140
|
}
|
|
125
141
|
if (/not found|no stable id/i.test(msg)) {
|
|
126
|
-
throw ctx.fail('not_found', `ID ${input.id} not found in Ensembl
|
|
142
|
+
throw ctx.fail('not_found', `ID ${input.id} not found in Ensembl.`, {
|
|
143
|
+
...ctx.recoveryFor('not_found'),
|
|
144
|
+
});
|
|
127
145
|
}
|
|
128
146
|
throw err;
|
|
129
147
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sequence.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-sequence.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,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAU,CAAC;AAEtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,sBAAsB,EAAE;IAC7D,KAAK,EAAE,cAAc;IACrB,WAAW,EACT,oGAAoG;QACpG,oGAAoG;QACpG,sGAAsG;QACtG,6FAA6F;QAC7F,
|
|
1
|
+
{"version":3,"file":"get-sequence.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-sequence.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,cAAc,GAAG,CAAC,SAA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E,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-xrefs.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-xrefs.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAyBjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"get-xrefs.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-xrefs.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAyBjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;EAqH1B,CAAC"}
|
|
@@ -75,7 +75,9 @@ export const ensemblGetXrefs = tool('ensembl_get_xrefs', {
|
|
|
75
75
|
.catch((err) => {
|
|
76
76
|
const msg = err instanceof Error ? err.message : String(err);
|
|
77
77
|
if (/not found/i.test(msg)) {
|
|
78
|
-
throw ctx.fail('not_found', `ID "${input.id}" not found in Ensembl
|
|
78
|
+
throw ctx.fail('not_found', `ID "${input.id}" not found in Ensembl.`, {
|
|
79
|
+
...ctx.recoveryFor('not_found'),
|
|
80
|
+
});
|
|
79
81
|
}
|
|
80
82
|
throw err;
|
|
81
83
|
});
|