@cyanheads/interpro-mcp-server 0.0.0-stage → 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.
- package/AGENTS.md +375 -0
- package/CLAUDE.md +375 -0
- package/Dockerfile +186 -0
- package/LICENSE +201 -0
- package/README.md +263 -2
- package/changelog/0.1.x/0.1.1.md +20 -0
- package/changelog/template.md +151 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-find-proteins-by-domain.tool.d.ts +177 -0
- package/dist/mcp-server/tools/definitions/interpro-find-proteins-by-domain.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-find-proteins-by-domain.tool.js +192 -0
- package/dist/mcp-server/tools/definitions/interpro-find-proteins-by-domain.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-get-clan.tool.d.ts +160 -0
- package/dist/mcp-server/tools/definitions/interpro-get-clan.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-get-clan.tool.js +259 -0
- package/dist/mcp-server/tools/definitions/interpro-get-clan.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-get-entry.tool.d.ts +130 -0
- package/dist/mcp-server/tools/definitions/interpro-get-entry.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-get-entry.tool.js +100 -0
- package/dist/mcp-server/tools/definitions/interpro-get-entry.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-get-protein-domains.tool.d.ts +172 -0
- package/dist/mcp-server/tools/definitions/interpro-get-protein-domains.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-get-protein-domains.tool.js +374 -0
- package/dist/mcp-server/tools/definitions/interpro-get-protein-domains.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-list-reference.tool.d.ts +89 -0
- package/dist/mcp-server/tools/definitions/interpro-list-reference.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-list-reference.tool.js +99 -0
- package/dist/mcp-server/tools/definitions/interpro-list-reference.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-search-entries.tool.d.ts +184 -0
- package/dist/mcp-server/tools/definitions/interpro-search-entries.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/interpro-search-entries.tool.js +155 -0
- package/dist/mcp-server/tools/definitions/interpro-search-entries.tool.js.map +1 -0
- package/dist/services/interpro/budget.d.ts +26 -0
- package/dist/services/interpro/budget.d.ts.map +1 -0
- package/dist/services/interpro/budget.js +41 -0
- package/dist/services/interpro/budget.js.map +1 -0
- package/dist/services/interpro/cursors.d.ts +25 -0
- package/dist/services/interpro/cursors.d.ts.map +1 -0
- package/dist/services/interpro/cursors.js +99 -0
- package/dist/services/interpro/cursors.js.map +1 -0
- package/dist/services/interpro/format.d.ts +17 -0
- package/dist/services/interpro/format.d.ts.map +1 -0
- package/dist/services/interpro/format.js +130 -0
- package/dist/services/interpro/format.js.map +1 -0
- package/dist/services/interpro/http-adapter.d.ts +11 -0
- package/dist/services/interpro/http-adapter.d.ts.map +1 -0
- package/dist/services/interpro/http-adapter.js +134 -0
- package/dist/services/interpro/http-adapter.js.map +1 -0
- package/dist/services/interpro/interpro-service.d.ts +57 -0
- package/dist/services/interpro/interpro-service.d.ts.map +1 -0
- package/dist/services/interpro/interpro-service.js +284 -0
- package/dist/services/interpro/interpro-service.js.map +1 -0
- package/dist/services/interpro/reference.d.ts +31 -0
- package/dist/services/interpro/reference.d.ts.map +1 -0
- package/dist/services/interpro/reference.js +122 -0
- package/dist/services/interpro/reference.js.map +1 -0
- package/dist/services/interpro/relationships.d.ts +38 -0
- package/dist/services/interpro/relationships.d.ts.map +1 -0
- package/dist/services/interpro/relationships.js +70 -0
- package/dist/services/interpro/relationships.js.map +1 -0
- package/dist/services/interpro/routing.d.ts +24 -0
- package/dist/services/interpro/routing.d.ts.map +1 -0
- package/dist/services/interpro/routing.js +106 -0
- package/dist/services/interpro/routing.js.map +1 -0
- package/dist/services/interpro/schemas.d.ts +182 -0
- package/dist/services/interpro/schemas.d.ts.map +1 -0
- package/dist/services/interpro/schemas.js +215 -0
- package/dist/services/interpro/schemas.js.map +1 -0
- package/dist/services/interpro/upstream-errors.d.ts +43 -0
- package/dist/services/interpro/upstream-errors.d.ts.map +1 -0
- package/dist/services/interpro/upstream-errors.js +49 -0
- package/dist/services/interpro/upstream-errors.js.map +1 -0
- package/package.json +103 -4
- package/server.json +85 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Validated accession routing and fixed-origin InterPro URLs.
|
|
3
|
+
* @module services/interpro/routing
|
|
4
|
+
*/
|
|
5
|
+
import { notFound, validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
6
|
+
import { AccessionSchema } from './schemas.js';
|
|
7
|
+
/** Canonical API origin; no upstream continuation URL is fetched directly. */
|
|
8
|
+
export const API_BASE = 'https://www.ebi.ac.uk/interpro/api/';
|
|
9
|
+
/** Official reference documentation. */
|
|
10
|
+
export const DOCUMENTATION_URL = 'https://interpro-documentation.readthedocs.io/en/latest/api.html';
|
|
11
|
+
/** Routing patterns and examples are shared with the reference vocabulary. */
|
|
12
|
+
export const ENTRY_ROUTES = [
|
|
13
|
+
{ source: 'interpro', pattern: /^IPR\d{6}$/i, example: 'IPR011615' },
|
|
14
|
+
{ source: 'pfam', pattern: /^PF\d{5}$/i, example: 'PF00870' },
|
|
15
|
+
{ source: 'prosite', pattern: /^PS00\d{3}$/i, example: 'PS00107' },
|
|
16
|
+
{ source: 'profile', pattern: /^PS5\d{4}$/i, example: 'PS50011' },
|
|
17
|
+
{ source: 'smart', pattern: /^SM\d{5}$/i, example: 'SM00220' },
|
|
18
|
+
{ source: 'cdd', pattern: /^cd\d+$/i, example: 'cd08367' },
|
|
19
|
+
{ source: 'panther', pattern: /^PTHR\d+(?::SF\d+)?$/i, example: 'PTHR11447' },
|
|
20
|
+
{ source: 'cathgene3d', pattern: /^G3DSA:\d+\.\d+\.\d+\.\d+$/i, example: 'G3DSA:3.30.200.20' },
|
|
21
|
+
{ source: 'ssf', pattern: /^SSF\d+$/i, example: 'SSF56112' },
|
|
22
|
+
{ source: 'ncbifam', pattern: /^(?:TIGR|NF)\d+$/i, example: 'TIGR00001' },
|
|
23
|
+
{ source: 'hamap', pattern: /^MF_\d+$/i, example: 'MF_00001' },
|
|
24
|
+
{ source: 'prints', pattern: /^PR\d+$/i, example: 'PR00386' },
|
|
25
|
+
{ source: 'pirsf', pattern: /^PIRSF\d+$/i, example: 'PIRSF000047' },
|
|
26
|
+
{ source: 'sfld', pattern: /^SFLD[A-Z]?\d+$/i, example: 'SFLDF00001' },
|
|
27
|
+
{ source: 'antifam', pattern: /^ANF\d+$/i, example: 'ANF00001' },
|
|
28
|
+
];
|
|
29
|
+
/** Pfam clan (`CL`) and CDD superfamily (`cl`) accessions name sets, never entries. */
|
|
30
|
+
const CLAN_PATTERN = /^cl\d+$/i;
|
|
31
|
+
/** Resolve one entry accession without guessing alternate databases after a miss. */
|
|
32
|
+
export function resolveEntry(accession, sourceDatabase) {
|
|
33
|
+
const safe = AccessionSchema.parse(accession);
|
|
34
|
+
if (CLAN_PATTERN.test(safe))
|
|
35
|
+
throw notFound(`${safe} is a set accession, not an entry accession.`, {
|
|
36
|
+
reason: 'entry_not_found',
|
|
37
|
+
retryable: false,
|
|
38
|
+
accession: safe,
|
|
39
|
+
recovery: {
|
|
40
|
+
hint: 'Call interpro_get_clan with this accession to read the set and its member entries.',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
const inferred = ENTRY_ROUTES.find((route) => route.pattern.test(safe))?.source;
|
|
44
|
+
if (inferred && sourceDatabase && inferred !== sourceDatabase)
|
|
45
|
+
throw validationError(`Accession ${safe} routes to sourceDatabase ${inferred} by its prefix, not ${sourceDatabase}.`, {
|
|
46
|
+
reason: 'database_mismatch',
|
|
47
|
+
retryable: false,
|
|
48
|
+
accession: safe,
|
|
49
|
+
sourceDatabase,
|
|
50
|
+
inferredSourceDatabase: inferred,
|
|
51
|
+
});
|
|
52
|
+
const source = sourceDatabase ?? inferred;
|
|
53
|
+
if (!source)
|
|
54
|
+
throw validationError(`Accession ${safe} matches no standard prefix, and no sourceDatabase was supplied.`, { reason: 'accession_source_unknown', retryable: false, accession: safe });
|
|
55
|
+
return {
|
|
56
|
+
accession: inferred ? (source === 'cdd' ? safe.toLowerCase() : safe.toUpperCase()) : safe,
|
|
57
|
+
sourceDatabase: source,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** Resolve case-sensitive CL clan prefixes, with explicit source disambiguation. */
|
|
61
|
+
export function resolveClan(accession, sourceDatabase) {
|
|
62
|
+
const safe = AccessionSchema.parse(accession);
|
|
63
|
+
const isCl = CLAN_PATTERN.test(safe);
|
|
64
|
+
const isPirsf = /^PIRSF\d+$/i.test(safe);
|
|
65
|
+
const inferred = /^CL\d+$/.test(safe)
|
|
66
|
+
? 'pfam'
|
|
67
|
+
: /^cl\d+$/.test(safe)
|
|
68
|
+
? 'cdd'
|
|
69
|
+
: isPirsf
|
|
70
|
+
? 'pirsf'
|
|
71
|
+
: undefined;
|
|
72
|
+
if ((isPirsf && sourceDatabase && sourceDatabase !== 'pirsf') ||
|
|
73
|
+
(isCl && sourceDatabase === 'pirsf'))
|
|
74
|
+
throw validationError(`Set accession ${safe} routes to sourceDatabase ${inferred ?? 'pfam or cdd'} by its prefix, not ${sourceDatabase}.`, {
|
|
75
|
+
reason: 'database_mismatch',
|
|
76
|
+
retryable: false,
|
|
77
|
+
accession: safe,
|
|
78
|
+
sourceDatabase,
|
|
79
|
+
...(inferred ? { inferredSourceDatabase: inferred } : {}),
|
|
80
|
+
});
|
|
81
|
+
const source = sourceDatabase ?? inferred;
|
|
82
|
+
if (!source)
|
|
83
|
+
throw validationError(isCl
|
|
84
|
+
? `Set accession ${safe} has a mixed-case CL prefix, which can name a Pfam or CDD set, and no sourceDatabase was supplied.`
|
|
85
|
+
: `Set accession ${safe} matches no set prefix, and no sourceDatabase was supplied.`, { reason: 'accession_source_unknown', retryable: false, accession: safe });
|
|
86
|
+
return {
|
|
87
|
+
accession: isCl
|
|
88
|
+
? source === 'cdd'
|
|
89
|
+
? safe.toLowerCase()
|
|
90
|
+
: safe.toUpperCase()
|
|
91
|
+
: inferred
|
|
92
|
+
? safe.toUpperCase()
|
|
93
|
+
: safe,
|
|
94
|
+
sourceDatabase: source,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** Build fixed-origin requests from independently validated, encoded path segments. */
|
|
98
|
+
export function apiUrl(segments, query = {}) {
|
|
99
|
+
const path = segments.map((part) => encodeURIComponent(AccessionSchema.parse(part))).join('/');
|
|
100
|
+
const url = new URL(`${path}${path ? '/' : ''}`, API_BASE);
|
|
101
|
+
for (const [key, value] of Object.entries(query))
|
|
102
|
+
if (value !== undefined)
|
|
103
|
+
url.searchParams.set(key, String(value));
|
|
104
|
+
return url.href;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../../src/services/interpro/routing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAuB,MAAM,cAAc,CAAC;AAEpE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAC9D,wCAAwC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,kEAAkE,CAAC;AACpG,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GACvB;IACE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE;IACpE,EAAE,MAAM,EAAE,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C;IACJ,OAAO;QACL,SAAS,EAAE,IAAI;YACb,CAAC,CAAC,MAAM,KAAK,KAAK;gBAChB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE;gBACpB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE;YACtB,CAAC,CAAC,QAAQ;gBACR,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE;gBACpB,CAAC,CAAC,IAAI;QACV,cAAc,EAAE,MAAM;KACvB,CAAC;AACJ,CAAC;AACD,uFAAuF;AACvF,MAAM,UAAU,MAAM,CACpB,QAA2B,EAC3B,KAAK,GAAoE,EAAE;IAE3E,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/F,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC3D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAC9C,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Lossless InterPro wire schemas and shared input vocabulary.
|
|
3
|
+
* @module services/interpro/schemas
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
/** JSON values retained verbatim from upstream records. */
|
|
7
|
+
export declare const JsonValueSchema: z.ZodJSONSchema;
|
|
8
|
+
/** An upstream object with every additional JSON field retained. */
|
|
9
|
+
export declare const JsonObjectSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
10
|
+
/** Supported entry API routes, including separate PROSITE pattern and profile routes. */
|
|
11
|
+
export declare const SourceDatabaseSchema: z.ZodEnum<{
|
|
12
|
+
antifam: "antifam";
|
|
13
|
+
cathgene3d: "cathgene3d";
|
|
14
|
+
cdd: "cdd";
|
|
15
|
+
hamap: "hamap";
|
|
16
|
+
interpro: "interpro";
|
|
17
|
+
ncbifam: "ncbifam";
|
|
18
|
+
panther: "panther";
|
|
19
|
+
pfam: "pfam";
|
|
20
|
+
pirsf: "pirsf";
|
|
21
|
+
prints: "prints";
|
|
22
|
+
profile: "profile";
|
|
23
|
+
prosite: "prosite";
|
|
24
|
+
sfld: "sfld";
|
|
25
|
+
smart: "smart";
|
|
26
|
+
ssf: "ssf";
|
|
27
|
+
}>;
|
|
28
|
+
/** Entry annotation categories. */
|
|
29
|
+
export declare const EntryTypeSchema: z.ZodEnum<{
|
|
30
|
+
active_site: "active_site";
|
|
31
|
+
binding_site: "binding_site";
|
|
32
|
+
coiled_coil: "coiled_coil";
|
|
33
|
+
conserved_site: "conserved_site";
|
|
34
|
+
disordered: "disordered";
|
|
35
|
+
domain: "domain";
|
|
36
|
+
family: "family";
|
|
37
|
+
homologous_superfamily: "homologous_superfamily";
|
|
38
|
+
ptm: "ptm";
|
|
39
|
+
region: "region";
|
|
40
|
+
repeat: "repeat";
|
|
41
|
+
}>;
|
|
42
|
+
/** A validated database route. */
|
|
43
|
+
export type SourceDatabase = z.infer<typeof SourceDatabaseSchema>;
|
|
44
|
+
/** Form clients may submit blank optional strings. */
|
|
45
|
+
export declare const optionalString: <T extends z.ZodType>(schema: T) => z.ZodPreprocess<z.ZodOptional<T>, unknown>;
|
|
46
|
+
/** A blank string takes the `.default()` that `schema` declares, as an omitted one does. */
|
|
47
|
+
export declare const defaultedString: <T extends z.ZodType>(schema: T) => z.ZodPreprocess<T, unknown>;
|
|
48
|
+
/** Safe identifiers are encoded as a single path segment after validation. */
|
|
49
|
+
export declare const AccessionSchema: z.ZodString;
|
|
50
|
+
/**
|
|
51
|
+
* Whether an upstream value is exactly an accession, the only form server-written text may name
|
|
52
|
+
* it in. The schema trims, so a value padded with blank lines must not pass as one.
|
|
53
|
+
*/
|
|
54
|
+
export declare const isAccession: (value: unknown) => value is string;
|
|
55
|
+
/** Canonical UniProt accessions exclude isoform suffixes. */
|
|
56
|
+
export declare const ProteinAccessionSchema: z.ZodString;
|
|
57
|
+
/** GO annotation returned by InterPro. */
|
|
58
|
+
export declare const GoTermSchema: z.ZodObject<{
|
|
59
|
+
identifier: z.ZodString;
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
category: z.ZodObject<{
|
|
62
|
+
code: z.ZodString;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
65
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
66
|
+
/** Sparse list metadata; only routing fields are required. */
|
|
67
|
+
export declare const EntrySummarySchema: z.ZodObject<{
|
|
68
|
+
accession: z.ZodString;
|
|
69
|
+
source_database: z.ZodString;
|
|
70
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
71
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
integrated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
member_databases: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>>;
|
|
74
|
+
go_terms: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
75
|
+
identifier: z.ZodString;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
category: z.ZodObject<{
|
|
78
|
+
code: z.ZodString;
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
81
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>>>;
|
|
82
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
83
|
+
/** Detail metadata differs from summary metadata: names are objects. */
|
|
84
|
+
export declare const EntryMetadataSchema: z.ZodObject<{
|
|
85
|
+
accession: z.ZodString;
|
|
86
|
+
source_database: z.ZodString;
|
|
87
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
88
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
|
+
short: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
91
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
92
|
+
/** Complete location fragments retain discontinuity and arbitrary annotations. */
|
|
93
|
+
export declare const LocationSchema: z.ZodObject<{
|
|
94
|
+
fragments: z.ZodArray<z.ZodObject<{
|
|
95
|
+
start: z.ZodNumber;
|
|
96
|
+
end: z.ZodNumber;
|
|
97
|
+
'dc-status': z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>;
|
|
99
|
+
representative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
100
|
+
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
101
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
102
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
103
|
+
/** Protein metadata preserves omitted annotations and additional source fields. */
|
|
104
|
+
export declare const ProteinMetadataSchema: z.ZodObject<{
|
|
105
|
+
accession: z.ZodString;
|
|
106
|
+
length: z.ZodNumber;
|
|
107
|
+
source_database: z.ZodString;
|
|
108
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
|
+
gene: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
110
|
+
source_organism: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
taxId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
112
|
+
scientificName: z.ZodString;
|
|
113
|
+
fullName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>;
|
|
115
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
116
|
+
/** Protein match rows retain complete nested source records. */
|
|
117
|
+
export declare const MatchSchema: z.ZodObject<{
|
|
118
|
+
metadata: z.ZodObject<{
|
|
119
|
+
accession: z.ZodString;
|
|
120
|
+
source_database: z.ZodString;
|
|
121
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
122
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
123
|
+
integrated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
member_databases: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>>;
|
|
125
|
+
go_terms: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
126
|
+
identifier: z.ZodString;
|
|
127
|
+
name: z.ZodString;
|
|
128
|
+
category: z.ZodObject<{
|
|
129
|
+
code: z.ZodString;
|
|
130
|
+
name: z.ZodString;
|
|
131
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
132
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>>>;
|
|
133
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
134
|
+
proteins: z.ZodArray<z.ZodObject<{
|
|
135
|
+
accession: z.ZodString;
|
|
136
|
+
entry_protein_locations: z.ZodArray<z.ZodObject<{
|
|
137
|
+
fragments: z.ZodArray<z.ZodObject<{
|
|
138
|
+
start: z.ZodNumber;
|
|
139
|
+
end: z.ZodNumber;
|
|
140
|
+
'dc-status': z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>;
|
|
142
|
+
representative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
143
|
+
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
144
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
145
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>;
|
|
146
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>;
|
|
147
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
148
|
+
/** Feature-keyed extra annotations, not a protein detail envelope. */
|
|
149
|
+
export declare const ExtraFeaturesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
150
|
+
accession: z.ZodString;
|
|
151
|
+
source_database: z.ZodString;
|
|
152
|
+
locations: z.ZodArray<z.ZodObject<{
|
|
153
|
+
fragments: z.ZodArray<z.ZodObject<{
|
|
154
|
+
start: z.ZodNumber;
|
|
155
|
+
end: z.ZodNumber;
|
|
156
|
+
'dc-status': z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>;
|
|
158
|
+
representative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
159
|
+
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
160
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
161
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>;
|
|
162
|
+
}, z.core.$catchall<z.ZodJSONSchema>>>;
|
|
163
|
+
/** Standard list envelope; callers select the operation-specific row schema. */
|
|
164
|
+
export declare const listSchema: <T extends z.ZodType>(row: T) => z.ZodObject<{
|
|
165
|
+
count: z.ZodNumber;
|
|
166
|
+
next: z.ZodNullable<z.ZodString>;
|
|
167
|
+
previous: z.ZodNullable<z.ZodString>;
|
|
168
|
+
results: z.ZodArray<T>;
|
|
169
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
170
|
+
/** Detail response envelope. */
|
|
171
|
+
export declare const detailSchema: <T extends z.ZodType>(metadata: T) => z.ZodObject<{
|
|
172
|
+
metadata: T;
|
|
173
|
+
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
174
|
+
/** Server-owned page metadata. */
|
|
175
|
+
export declare const PageSchema: z.ZodObject<{
|
|
176
|
+
total: z.ZodNumber;
|
|
177
|
+
returned: z.ZodNumber;
|
|
178
|
+
limit: z.ZodNumber;
|
|
179
|
+
hasMore: z.ZodBoolean;
|
|
180
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/services/interpro/schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C,2DAA2D;AAC3D,eAAO,MAAM,eAAe,iBAAiD,CAAC;AAC9E,oEAAoE;AACpE,eAAO,MAAM,gBAAgB,2CAEgB,CAAC;AAC9C,yFAAyF;AACzF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;EAkBe,CAAC;AACjD,mCAAmC;AACnC,eAAO,MAAM,eAAe;;;;;;;;;;;;EAcS,CAAC;AACtC,kCAAkC;AAClC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE,sDAAsD;AACtD,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,UAAU,CAAC,+CACjB,CAAC;AAC7C,4FAA4F;AAC5F,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,UAAU,CAAC,gCAAoC,CAAC;AACnG,8EAA8E;AAC9E,eAAO,MAAM,eAAe,aAOyC,CAAC;AACtE;;;GAGG;AACH,eAAO,MAAM,WAAW,UAAW,OAAO,KAAG,KAAK,IAAI,MACwB,CAAC;AAC/E,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,aAIyD,CAAC;AAC7F,0CAA0C;AAC1C,eAAO,MAAM,YAAY;;;;;;;qCAaI,CAAC;AAC9B,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;qCAcH,CAAC;AAC7B,wEAAwE;AACxE,eAAO,MAAM,mBAAmB;;;;;;;qCAcJ,CAAC;AAC7B,kFAAkF;AAClF,eAAO,MAAM,cAAc;;;;;;;;;qCAqBqB,CAAC;AACjD,mFAAmF;AACnF,eAAO,MAAM,qBAAqB;;;;;;;;;;;qCAsBN,CAAC;AAC7B,gEAAgE;AAChE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAmBI,CAAC;AAC7B,sEAAsE;AACtE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;sCAS/B,CAAC;AACF,gFAAgF;AAChF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,OAAO,CAAC;;;;;qCAQxB,CAAC;AAC/B,gCAAgC;AAChC,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,YAAY,CAAC;;qCACqC,CAAC;AACnG,kCAAkC;AAClC,eAAO,MAAM,UAAU;;;;;;iBASrB,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Lossless InterPro wire schemas and shared input vocabulary.
|
|
3
|
+
* @module services/interpro/schemas
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
/** JSON values retained verbatim from upstream records. */
|
|
7
|
+
export const JsonValueSchema = z.json().describe('An unmodified JSON value.');
|
|
8
|
+
/** An upstream object with every additional JSON field retained. */
|
|
9
|
+
export const JsonObjectSchema = z
|
|
10
|
+
.record(z.string(), JsonValueSchema)
|
|
11
|
+
.describe('Complete upstream JSON object.');
|
|
12
|
+
/** Supported entry API routes, including separate PROSITE pattern and profile routes. */
|
|
13
|
+
export const SourceDatabaseSchema = z
|
|
14
|
+
.enum([
|
|
15
|
+
'interpro',
|
|
16
|
+
'pfam',
|
|
17
|
+
'prosite',
|
|
18
|
+
'profile',
|
|
19
|
+
'smart',
|
|
20
|
+
'cdd',
|
|
21
|
+
'panther',
|
|
22
|
+
'cathgene3d',
|
|
23
|
+
'ssf',
|
|
24
|
+
'ncbifam',
|
|
25
|
+
'hamap',
|
|
26
|
+
'prints',
|
|
27
|
+
'pirsf',
|
|
28
|
+
'sfld',
|
|
29
|
+
'antifam',
|
|
30
|
+
])
|
|
31
|
+
.describe('InterPro entry API database slug.');
|
|
32
|
+
/** Entry annotation categories. */
|
|
33
|
+
export const EntryTypeSchema = z
|
|
34
|
+
.enum([
|
|
35
|
+
'domain',
|
|
36
|
+
'family',
|
|
37
|
+
'repeat',
|
|
38
|
+
'homologous_superfamily',
|
|
39
|
+
'active_site',
|
|
40
|
+
'binding_site',
|
|
41
|
+
'conserved_site',
|
|
42
|
+
'ptm',
|
|
43
|
+
'region',
|
|
44
|
+
'coiled_coil',
|
|
45
|
+
'disordered',
|
|
46
|
+
])
|
|
47
|
+
.describe('Entry annotation type.');
|
|
48
|
+
/** A blank or whitespace-only string from a form client reads as omitted. */
|
|
49
|
+
const omitBlank = (value) => typeof value === 'string' && value.trim() === '' ? undefined : value;
|
|
50
|
+
/** Form clients may submit blank optional strings. */
|
|
51
|
+
export const optionalString = (schema) => z.preprocess(omitBlank, schema.optional());
|
|
52
|
+
/** A blank string takes the `.default()` that `schema` declares, as an omitted one does. */
|
|
53
|
+
export const defaultedString = (schema) => z.preprocess(omitBlank, schema);
|
|
54
|
+
/** Safe identifiers are encoded as a single path segment after validation. */
|
|
55
|
+
export const AccessionSchema = z
|
|
56
|
+
.string()
|
|
57
|
+
.trim()
|
|
58
|
+
.min(1)
|
|
59
|
+
.max(100)
|
|
60
|
+
.regex(/^[A-Za-z0-9_.:-]+$/)
|
|
61
|
+
.refine((value) => value !== '.' && value !== '..', 'Dot segments are not accessions.')
|
|
62
|
+
.describe('Identifier encoded as one path segment; no URL syntax.');
|
|
63
|
+
/**
|
|
64
|
+
* Whether an upstream value is exactly an accession, the only form server-written text may name
|
|
65
|
+
* it in. The schema trims, so a value padded with blank lines must not pass as one.
|
|
66
|
+
*/
|
|
67
|
+
export const isAccession = (value) => typeof value === 'string' && AccessionSchema.safeParse(value).data === value;
|
|
68
|
+
/** Canonical UniProt accessions exclude isoform suffixes. */
|
|
69
|
+
export const ProteinAccessionSchema = z
|
|
70
|
+
.string()
|
|
71
|
+
.trim()
|
|
72
|
+
.regex(/^(?:[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9](?:[A-Z][A-Z0-9]{2}[0-9]){1,2})$/i)
|
|
73
|
+
.describe('Canonical six- or ten-character UniProt accession, without an isoform suffix.');
|
|
74
|
+
/** GO annotation returned by InterPro. */
|
|
75
|
+
export const GoTermSchema = z
|
|
76
|
+
.object({
|
|
77
|
+
identifier: z.string().describe('GO identifier.'),
|
|
78
|
+
name: z.string().describe('GO term name.'),
|
|
79
|
+
category: z
|
|
80
|
+
.object({
|
|
81
|
+
code: z.string().describe('GO category code.'),
|
|
82
|
+
name: z.string().describe('GO category name.'),
|
|
83
|
+
})
|
|
84
|
+
.catchall(JsonValueSchema)
|
|
85
|
+
.describe('GO category.'),
|
|
86
|
+
})
|
|
87
|
+
.catchall(JsonValueSchema)
|
|
88
|
+
.describe('GO annotation.');
|
|
89
|
+
/** Sparse list metadata; only routing fields are required. */
|
|
90
|
+
export const EntrySummarySchema = z
|
|
91
|
+
.object({
|
|
92
|
+
accession: z.string().describe('Entry accession.'),
|
|
93
|
+
source_database: z.string().describe('Upstream source database.'),
|
|
94
|
+
name: z.string().nullable().optional().describe('Entry name when supplied.'),
|
|
95
|
+
type: z.string().nullable().optional().describe('Entry type when supplied.'),
|
|
96
|
+
integrated: z.string().nullable().optional().describe('Integrated InterPro accession.'),
|
|
97
|
+
member_databases: z
|
|
98
|
+
.record(z.string(), z.record(z.string(), z.string()))
|
|
99
|
+
.nullable()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe('Member signatures grouped by database.'),
|
|
102
|
+
go_terms: z.array(GoTermSchema).nullable().optional().describe('GO annotations when supplied.'),
|
|
103
|
+
})
|
|
104
|
+
.catchall(JsonValueSchema);
|
|
105
|
+
/** Detail metadata differs from summary metadata: names are objects. */
|
|
106
|
+
export const EntryMetadataSchema = z
|
|
107
|
+
.object({
|
|
108
|
+
accession: z.string().describe('Entry accession.'),
|
|
109
|
+
source_database: z.string().describe('Upstream database.'),
|
|
110
|
+
name: z
|
|
111
|
+
.object({
|
|
112
|
+
name: z.string().nullable().optional().describe('Full name.'),
|
|
113
|
+
short: z.string().nullable().optional().describe('Short name.'),
|
|
114
|
+
})
|
|
115
|
+
.catchall(JsonValueSchema)
|
|
116
|
+
.nullable()
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Detail name object.'),
|
|
119
|
+
})
|
|
120
|
+
.catchall(JsonValueSchema);
|
|
121
|
+
/** Complete location fragments retain discontinuity and arbitrary annotations. */
|
|
122
|
+
export const LocationSchema = z
|
|
123
|
+
.object({
|
|
124
|
+
fragments: z
|
|
125
|
+
.array(z
|
|
126
|
+
.object({
|
|
127
|
+
start: z.number().int().positive().describe('Inclusive 1-based start residue.'),
|
|
128
|
+
end: z.number().int().positive().describe('Inclusive 1-based end residue.'),
|
|
129
|
+
'dc-status': z.string().optional().describe('Discontinuity status.'),
|
|
130
|
+
})
|
|
131
|
+
.catchall(JsonValueSchema)
|
|
132
|
+
.refine((fragment) => fragment.start <= fragment.end, 'Fragment start exceeds end.')
|
|
133
|
+
.describe('Complete continuous or discontinuous sequence fragment.'))
|
|
134
|
+
.min(1)
|
|
135
|
+
.describe('Nonempty sequence fragments.'),
|
|
136
|
+
representative: z.boolean().nullable().optional().describe('Representative match flag.'),
|
|
137
|
+
model: z.string().nullable().optional().describe('Source model.'),
|
|
138
|
+
score: z.number().nullable().optional().describe('Upstream match score.'),
|
|
139
|
+
})
|
|
140
|
+
.catchall(JsonValueSchema)
|
|
141
|
+
.describe('Complete upstream match location.');
|
|
142
|
+
/** Protein metadata preserves omitted annotations and additional source fields. */
|
|
143
|
+
export const ProteinMetadataSchema = z
|
|
144
|
+
.object({
|
|
145
|
+
accession: z.string().describe('Protein accession.'),
|
|
146
|
+
length: z.number().int().positive().describe('Sequence length in residues.'),
|
|
147
|
+
source_database: z.string().describe('Protein source database.'),
|
|
148
|
+
name: z.string().nullable().optional().describe('Protein name.'),
|
|
149
|
+
gene: z.string().nullable().optional().describe('Gene name.'),
|
|
150
|
+
source_organism: z
|
|
151
|
+
.object({
|
|
152
|
+
taxId: z
|
|
153
|
+
.union([
|
|
154
|
+
z.string().describe('Taxonomy identifier as supplied text.'),
|
|
155
|
+
z.number().int().describe('Taxonomy identifier as supplied integer.'),
|
|
156
|
+
])
|
|
157
|
+
.describe('Taxonomy identifier.'),
|
|
158
|
+
scientificName: z.string().describe('Scientific organism name.'),
|
|
159
|
+
fullName: z.string().nullable().optional().describe('Full organism name.'),
|
|
160
|
+
})
|
|
161
|
+
.catchall(JsonValueSchema)
|
|
162
|
+
.optional()
|
|
163
|
+
.describe('Source organism.'),
|
|
164
|
+
})
|
|
165
|
+
.catchall(JsonValueSchema);
|
|
166
|
+
/** Protein match rows retain complete nested source records. */
|
|
167
|
+
export const MatchSchema = z
|
|
168
|
+
.object({
|
|
169
|
+
metadata: EntrySummarySchema.describe('Entry metadata.'),
|
|
170
|
+
proteins: z
|
|
171
|
+
.array(z
|
|
172
|
+
.object({
|
|
173
|
+
accession: z.string().describe('Matched protein accession.'),
|
|
174
|
+
entry_protein_locations: z
|
|
175
|
+
.array(LocationSchema)
|
|
176
|
+
.min(1)
|
|
177
|
+
.describe('Complete match locations.'),
|
|
178
|
+
})
|
|
179
|
+
.catchall(JsonValueSchema)
|
|
180
|
+
.describe('Complete protein match object.'))
|
|
181
|
+
.min(1)
|
|
182
|
+
.describe('Protein match objects.'),
|
|
183
|
+
})
|
|
184
|
+
.catchall(JsonValueSchema);
|
|
185
|
+
/** Feature-keyed extra annotations, not a protein detail envelope. */
|
|
186
|
+
export const ExtraFeaturesSchema = z.record(z.string(), z
|
|
187
|
+
.object({
|
|
188
|
+
accession: z.string().describe('Feature accession.'),
|
|
189
|
+
source_database: z.string().describe('Feature source.'),
|
|
190
|
+
locations: z.array(LocationSchema).describe('Feature locations.'),
|
|
191
|
+
})
|
|
192
|
+
.catchall(JsonValueSchema));
|
|
193
|
+
/** Standard list envelope; callers select the operation-specific row schema. */
|
|
194
|
+
export const listSchema = (row) => z
|
|
195
|
+
.object({
|
|
196
|
+
count: z.number().int().nonnegative().describe('Total matching records.'),
|
|
197
|
+
next: z.string().nullable().describe('Upstream continuation URL.'),
|
|
198
|
+
previous: z.string().nullable().describe('Upstream previous URL.'),
|
|
199
|
+
results: z.array(row).describe('Current page records.'),
|
|
200
|
+
})
|
|
201
|
+
.catchall(JsonValueSchema);
|
|
202
|
+
/** Detail response envelope. */
|
|
203
|
+
export const detailSchema = (metadata) => z.object({ metadata: metadata.describe('Complete detail metadata.') }).catchall(JsonValueSchema);
|
|
204
|
+
/** Server-owned page metadata. */
|
|
205
|
+
export const PageSchema = z.object({
|
|
206
|
+
total: z.number().int().nonnegative().describe('Upstream total records.'),
|
|
207
|
+
returned: z.number().int().nonnegative().describe('Records returned in this page.'),
|
|
208
|
+
limit: z.number().int().positive().describe('Requested page size.'),
|
|
209
|
+
hasMore: z.boolean().describe('Whether upstream advertises continuation.'),
|
|
210
|
+
nextCursor: z
|
|
211
|
+
.string()
|
|
212
|
+
.optional()
|
|
213
|
+
.describe('Opaque continuation with unchanged target and filters.'),
|
|
214
|
+
});
|
|
215
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/services/interpro/schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C,2DAA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AM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACnE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IAC1E,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,wDAAwD,CAAC;CACtE,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Error contracts for upstream failures the service raises identically for every tool.
|
|
3
|
+
* @module services/interpro/upstream-errors
|
|
4
|
+
*/
|
|
5
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
6
|
+
/** Declared upstream failures every tool shares; spread after `upstream_shape_invalid`. */
|
|
7
|
+
export declare const UPSTREAM_ERRORS: readonly [{
|
|
8
|
+
readonly reason: 'upstream_response_too_large';
|
|
9
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
10
|
+
readonly when: 'An upstream response exceeds 4 MiB.';
|
|
11
|
+
readonly retryable: false;
|
|
12
|
+
readonly recovery: 'Retry list tools with a smaller limit, or retrieve individual members with interpro_get_entry instead of a large clan.';
|
|
13
|
+
readonly thrownBy: 'service';
|
|
14
|
+
}, {
|
|
15
|
+
readonly reason: 'upstream_rejected';
|
|
16
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
17
|
+
readonly when: 'InterPro returns an unhandled redirect or client rejection.';
|
|
18
|
+
readonly retryable: false;
|
|
19
|
+
readonly recovery: 'Retry the same tool later; call interpro_list_reference with topic release to check upstream availability.';
|
|
20
|
+
readonly thrownBy: 'service';
|
|
21
|
+
}, {
|
|
22
|
+
readonly reason: 'upstream_unavailable';
|
|
23
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
24
|
+
readonly when: 'InterPro has a network or server failure; HTTP 501 is not retryable.';
|
|
25
|
+
readonly retryable: true;
|
|
26
|
+
readonly recovery: 'Retry the same tool later; call interpro_list_reference with topic release to check upstream availability.';
|
|
27
|
+
readonly thrownBy: 'service';
|
|
28
|
+
}, {
|
|
29
|
+
readonly reason: 'upstream_timeout';
|
|
30
|
+
readonly code: JsonRpcErrorCode.Timeout;
|
|
31
|
+
readonly when: 'InterPro returns HTTP 408/504 or an attempt exceeds its deadline.';
|
|
32
|
+
readonly retryable: true;
|
|
33
|
+
readonly recovery: 'Retry with a smaller limit where available, then repeat the same tool after waiting.';
|
|
34
|
+
readonly thrownBy: 'service';
|
|
35
|
+
}, {
|
|
36
|
+
readonly reason: 'upstream_rate_limited';
|
|
37
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
38
|
+
readonly when: 'InterPro returns HTTP 429.';
|
|
39
|
+
readonly retryable: true;
|
|
40
|
+
readonly recovery: 'Wait for retryAfter when supplied, then repeat the same tool with fewer concurrent calls.';
|
|
41
|
+
readonly thrownBy: 'service';
|
|
42
|
+
}];
|
|
43
|
+
//# sourceMappingURL=upstream-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upstream-errors.d.ts","sourceRoot":"","sources":["../../../src/services/interpro/upstream-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,2FAA2F;AAC3F,eAAO,MAAM,eAAe;aAExB,MAAM,EAAE,6BAA6B;aACrC,IAAI;aACJ,IAAI,EAAE,qCAAqC;aAC3C,SAAS;aACT,QAAQ,EACN,wHAAwH;aAC1H,QAAQ,EAAE,SAAS;;aAGnB,MAAM,EAAE,mBAAmB;aAC3B,IAAI;aACJ,IAAI,EAAE,6DAA6D;aACnE,SAAS;aACT,QAAQ,EACN,4GAA4G;aAC9G,QAAQ,EAAE,SAAS;;aAGnB,MAAM,EAAE,sBAAsB;aAC9B,IAAI;aACJ,IAAI,EAAE,sEAAsE;aAC5E,SAAS;aACT,QAAQ,EACN,4GAA4G;aAC9G,QAAQ,EAAE,SAAS;;aAGnB,MAAM,EAAE,kBAAkB;aAC1B,IAAI;aACJ,IAAI,EAAE,mEAAmE;aACzE,SAAS;aACT,QAAQ,EACN,sFAAsF;aACxF,QAAQ,EAAE,SAAS;;aAGnB,MAAM,EAAE,uBAAuB;aAC/B,IAAI;aACJ,IAAI,EAAE,4BAA4B;aAClC,SAAS;aACT,QAAQ,EACN,2FAA2F;aAC7F,QAAQ,EAAE,SAAS;EAEb,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Error contracts for upstream failures the service raises identically for every tool.
|
|
3
|
+
* @module services/interpro/upstream-errors
|
|
4
|
+
*/
|
|
5
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
6
|
+
/** Declared upstream failures every tool shares; spread after `upstream_shape_invalid`. */
|
|
7
|
+
export const UPSTREAM_ERRORS = [
|
|
8
|
+
{
|
|
9
|
+
reason: 'upstream_response_too_large',
|
|
10
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
11
|
+
when: 'An upstream response exceeds 4 MiB.',
|
|
12
|
+
retryable: false,
|
|
13
|
+
recovery: 'Retry list tools with a smaller limit, or retrieve individual members with interpro_get_entry instead of a large clan.',
|
|
14
|
+
thrownBy: 'service',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
reason: 'upstream_rejected',
|
|
18
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
19
|
+
when: 'InterPro returns an unhandled redirect or client rejection.',
|
|
20
|
+
retryable: false,
|
|
21
|
+
recovery: 'Retry the same tool later; call interpro_list_reference with topic release to check upstream availability.',
|
|
22
|
+
thrownBy: 'service',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
reason: 'upstream_unavailable',
|
|
26
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
27
|
+
when: 'InterPro has a network or server failure; HTTP 501 is not retryable.',
|
|
28
|
+
retryable: true,
|
|
29
|
+
recovery: 'Retry the same tool later; call interpro_list_reference with topic release to check upstream availability.',
|
|
30
|
+
thrownBy: 'service',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
reason: 'upstream_timeout',
|
|
34
|
+
code: JsonRpcErrorCode.Timeout,
|
|
35
|
+
when: 'InterPro returns HTTP 408/504 or an attempt exceeds its deadline.',
|
|
36
|
+
retryable: true,
|
|
37
|
+
recovery: 'Retry with a smaller limit where available, then repeat the same tool after waiting.',
|
|
38
|
+
thrownBy: 'service',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
reason: 'upstream_rate_limited',
|
|
42
|
+
code: JsonRpcErrorCode.RateLimited,
|
|
43
|
+
when: 'InterPro returns HTTP 429.',
|
|
44
|
+
retryable: true,
|
|
45
|
+
recovery: 'Wait for retryAfter when supplied, then repeat the same tool with fewer concurrent calls.',
|
|
46
|
+
thrownBy: 'service',
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
//# sourceMappingURL=upstream-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upstream-errors.js","sourceRoot":"","sources":["../../../src/services/interpro/upstream-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,2FAA2F;AAC3F,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;QACE,MAAM,EAAE,6BAA6B;QACrC,IAAI,EAAE,gBAAgB,CAAC,kBAAkB;QACzC,IAAI,EAAE,qCAAqC;QAC3C,SAAS,EAAE,KAAK;QAChB,QAAQ,EACN,wHAAwH;QAC1H,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,MAAM,EAAE,mBAAmB;QAC3B,IAAI,EAAE,gBAAgB,CAAC,kBAAkB;QACzC,IAAI,EAAE,6DAA6D;QACnE,SAAS,EAAE,KAAK;QAChB,QAAQ,EACN,4GAA4G;QAC9G,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,MAAM,EAAE,sBAAsB;QAC9B,IAAI,EAAE,gBAAgB,CAAC,kBAAkB;QACzC,IAAI,EAAE,sEAAsE;QAC5E,SAAS,EAAE,IAAI;QACf,QAAQ,EACN,4GAA4G;QAC9G,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,IAAI,EAAE,gBAAgB,CAAC,OAAO;QAC9B,IAAI,EAAE,mEAAmE;QACzE,SAAS,EAAE,IAAI;QACf,QAAQ,EACN,sFAAsF;QACxF,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,MAAM,EAAE,uBAAuB;QAC/B,IAAI,EAAE,gBAAgB,CAAC,WAAW;QAClC,IAAI,EAAE,4BAA4B;QAClC,SAAS,EAAE,IAAI;QACf,QAAQ,EACN,2FAA2F;QAC7F,QAAQ,EAAE,SAAS;KACpB;CACO,CAAC"}
|