@cyanheads/pubchem-mcp-server 0.5.1 → 0.6.0
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/README.md +3 -1
- package/dist/mcp-server/tools/definitions/get-bioactivity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-bioactivity.tool.js +1 -0
- package/dist/mcp-server/tools/definitions/get-bioactivity.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-interactions.tool.d.ts +14 -0
- package/dist/mcp-server/tools/definitions/get-compound-interactions.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-interactions.tool.js +101 -12
- package/dist/mcp-server/tools/definitions/get-compound-interactions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-xrefs.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-xrefs.tool.js +1 -0
- package/dist/mcp-server/tools/definitions/get-compound-xrefs.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +17 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-assays.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-assays.tool.js +1 -0
- package/dist/mcp-server/tools/definitions/search-assays.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-compounds.tool.d.ts +3 -0
- package/dist/mcp-server/tools/definitions/search-compounds.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-compounds.tool.js +66 -33
- package/dist/mcp-server/tools/definitions/search-compounds.tool.js.map +1 -1
- package/dist/services/pubchem/pubchem-client.d.ts +29 -8
- package/dist/services/pubchem/pubchem-client.d.ts.map +1 -1
- package/dist/services/pubchem/pubchem-client.js +102 -37
- package/dist/services/pubchem/pubchem-client.js.map +1 -1
- package/dist/services/pubchem/types.d.ts +51 -0
- package/dist/services/pubchem/types.d.ts.map +1 -1
- package/dist/services/pubchem/types.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +3 -3
|
@@ -19,7 +19,7 @@ const queryTypeEnum = z.enum(['smiles', 'cid']);
|
|
|
19
19
|
const propertyEnum = z.enum(COMPOUND_PROPERTIES);
|
|
20
20
|
export const searchCompounds = tool('pubchem_search_compounds', {
|
|
21
21
|
title: 'Search Compounds',
|
|
22
|
-
description: 'Search PubChem for chemical compounds by identifier (name, SMILES, or InChIKey, batched up to 25), molecular formula in Hill notation, substructure or superstructure containment, or 2D Tanimoto similarity. Optionally hydrate results with properties to avoid a follow-up pubchem_get_compound_details call.',
|
|
22
|
+
description: 'Search PubChem for chemical compounds by identifier (name, SMILES, or InChIKey, batched up to 25), molecular formula in Hill notation, substructure or superstructure containment, or 2D Tanimoto similarity. Returns a page of CIDs — reach matches past maxResults with offset. Optionally hydrate results with properties to avoid a follow-up pubchem_get_compound_details call.',
|
|
23
23
|
annotations: {
|
|
24
24
|
readOnlyHint: true,
|
|
25
25
|
idempotentHint: true,
|
|
@@ -60,12 +60,20 @@ export const searchCompounds = tool('pubchem_search_compounds', {
|
|
|
60
60
|
.max(100)
|
|
61
61
|
.default(90)
|
|
62
62
|
.describe('Similarity search only. Minimum Tanimoto similarity (70-100). 90+ for close analogs, 70-80 for scaffold hops. Default: 90.'),
|
|
63
|
+
offset: z
|
|
64
|
+
.number()
|
|
65
|
+
.int()
|
|
66
|
+
.min(0)
|
|
67
|
+
.max(10000)
|
|
68
|
+
.default(0)
|
|
69
|
+
.describe('Zero-based index of the first CID to return. Pass the nextOffset from a previous call to read the following page. Identifier lookups resolve every match up front, so paging them is free; formula, substructure, superstructure, and similarity searches have to ask PubChem for offset + maxResults records to reach a page, so deep pages cost progressively more upstream — hence the 10000 ceiling. Default: 0.'),
|
|
63
70
|
maxResults: z
|
|
64
71
|
.number()
|
|
72
|
+
.int()
|
|
65
73
|
.min(1)
|
|
66
74
|
.max(200)
|
|
67
75
|
.default(20)
|
|
68
|
-
.describe('Maximum CIDs to return (1-200). Default: 20.'),
|
|
76
|
+
.describe('Maximum CIDs to return per page (1-200). Use offset to reach matches past this page. Default: 20.'),
|
|
69
77
|
properties: z
|
|
70
78
|
.array(propertyEnum)
|
|
71
79
|
.optional()
|
|
@@ -92,8 +100,9 @@ export const searchCompounds = tool('pubchem_search_compounds', {
|
|
|
92
100
|
.optional()
|
|
93
101
|
.describe('Identifier-mode only: input identifiers that resolved to no CID. Omitted when every identifier resolved and for non-identifier searches.'),
|
|
94
102
|
}),
|
|
95
|
-
// Agent-facing context — search strategy echo, total
|
|
96
|
-
//
|
|
103
|
+
// Agent-facing context — search strategy echo, total, the page boundary, and a notice
|
|
104
|
+
// covering unresolved identifiers, an empty page, and further pages. Reaches
|
|
105
|
+
// structuredContent and content[] automatically; not in the domain return.
|
|
97
106
|
//
|
|
98
107
|
// Bounded-total convention: a reported total states only what the server actually
|
|
99
108
|
// observed. `totalFound` carries a true count and appears only when the whole match set
|
|
@@ -108,21 +117,23 @@ export const searchCompounds = tool('pubchem_search_compounds', {
|
|
|
108
117
|
totalFound: z
|
|
109
118
|
.number()
|
|
110
119
|
.optional()
|
|
111
|
-
.describe('Exact number of matching CIDs
|
|
120
|
+
.describe('Exact number of matching CIDs across all pages. Omitted when a formula, substructure, superstructure, or similarity search saturated the records it requested — PubChem returns no match count for those, so totalFoundAtLeast reports a floor instead.'),
|
|
112
121
|
totalFoundAtLeast: z
|
|
113
122
|
.number()
|
|
114
123
|
.optional()
|
|
115
|
-
.describe('Lower bound on matching CIDs, reported in place of totalFound when the exact count is unavailable. At least this many match, and the true total may be higher;
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
.describe('Lower bound on matching CIDs, reported in place of totalFound when the exact count is unavailable. At least this many match, and the true total may be higher; page further with offset to observe more.'),
|
|
125
|
+
offset: z.number().describe('Zero-based index of the first CID returned.'),
|
|
126
|
+
nextOffset: z
|
|
127
|
+
.number()
|
|
118
128
|
.optional()
|
|
119
|
-
.describe('
|
|
120
|
-
|
|
129
|
+
.describe('Offset to pass on the next call to continue past this page. Omitted when no further matches remain.'),
|
|
130
|
+
truncated: z.boolean().optional().describe('True when matching CIDs remain past this page.'),
|
|
131
|
+
shown: z.number().optional().describe('CIDs returned on this page.'),
|
|
121
132
|
cap: z.number().optional().describe('The maxResults cap that was applied.'),
|
|
122
133
|
notice: z
|
|
123
134
|
.string()
|
|
124
135
|
.optional()
|
|
125
|
-
.describe('Recovery guidance when no compounds matched
|
|
136
|
+
.describe('Recovery guidance when no compounds matched, when the offset runs past the matches observed, when identifiers failed to resolve, or when further pages remain. Absent when this page is complete and every identifier resolved.'),
|
|
126
137
|
},
|
|
127
138
|
errors: [
|
|
128
139
|
{
|
|
@@ -153,10 +164,12 @@ export const searchCompounds = tool('pubchem_search_compounds', {
|
|
|
153
164
|
async handler(input, ctx) {
|
|
154
165
|
const client = getPubChemClient();
|
|
155
166
|
let allCids = [];
|
|
156
|
-
// Formula and structure searches are bounded server-side. One record past the
|
|
157
|
-
// enough to prove more matches exist without moving the rest of PubChem's match
|
|
158
|
-
// which for a common substructure runs to 16.3 MB of CIDs.
|
|
159
|
-
|
|
167
|
+
// Formula and structure searches are bounded server-side. One record past the requested
|
|
168
|
+
// page is enough to prove more matches exist without moving the rest of PubChem's match
|
|
169
|
+
// set, which for a common substructure runs to 16.3 MB of CIDs. The window has to cover
|
|
170
|
+
// the offset too — these endpoints take a record count, not a start position, and their
|
|
171
|
+
// ordering is a stable prefix, so reaching page N means asking for everything up to it.
|
|
172
|
+
const recordCap = input.offset + input.maxResults + 1;
|
|
160
173
|
let boundedSearch = false;
|
|
161
174
|
const identifierMap = new Map();
|
|
162
175
|
// Identifier-mode resolution tracking (#29): inputs that resolved to no CID, and
|
|
@@ -243,23 +256,33 @@ export const searchCompounds = tool('pubchem_search_compounds', {
|
|
|
243
256
|
break;
|
|
244
257
|
}
|
|
245
258
|
}
|
|
246
|
-
// Deduplicate
|
|
259
|
+
// Deduplicate, then take the requested page.
|
|
247
260
|
const uniqueCids = [...new Set(allCids)];
|
|
248
261
|
const observedTotal = uniqueCids.length;
|
|
249
|
-
const
|
|
262
|
+
const pagedCids = uniqueCids.slice(input.offset, input.offset + input.maxResults);
|
|
250
263
|
// A bounded search that came back short of its cap returned everything PubChem had, so
|
|
251
264
|
// the count is exact. A saturated one only proves a floor.
|
|
252
265
|
const totalIsExact = !boundedSearch || allCids.length < recordCap;
|
|
266
|
+
// The stride comes from the page that was returned, never from maxResults — that input
|
|
267
|
+
// accepts a fractional value, which would emit a nextOffset this tool's own integer
|
|
268
|
+
// offset validator then rejects.
|
|
269
|
+
const nextOffset = input.offset + pagedCids.length;
|
|
270
|
+
// A saturated bounded search proved a record beyond the window it asked for, so more
|
|
271
|
+
// remain even though observedTotal cannot say how many.
|
|
272
|
+
const hasMore = !totalIsExact || nextOffset < observedTotal;
|
|
253
273
|
ctx.log.info('Search completed', {
|
|
254
274
|
searchType: input.searchType,
|
|
255
275
|
observedTotal,
|
|
256
276
|
totalIsExact,
|
|
257
|
-
|
|
277
|
+
offset: input.offset,
|
|
278
|
+
returned: pagedCids.length,
|
|
258
279
|
});
|
|
259
|
-
// Agent-facing context: search strategy echo, total, and
|
|
280
|
+
// Agent-facing context: search strategy echo, total, page boundary, and notices.
|
|
260
281
|
ctx.enrich(totalIsExact
|
|
261
|
-
? { searchType: input.searchType, totalFound: observedTotal }
|
|
262
|
-
: { searchType: input.searchType, totalFoundAtLeast: observedTotal });
|
|
282
|
+
? { searchType: input.searchType, totalFound: observedTotal, offset: input.offset }
|
|
283
|
+
: { searchType: input.searchType, totalFoundAtLeast: observedTotal, offset: input.offset });
|
|
284
|
+
if (hasMore)
|
|
285
|
+
ctx.enrich({ nextOffset });
|
|
263
286
|
// Identifier-mode signals (#29): name inputs that did not resolve and flag CID
|
|
264
287
|
// collisions, so a partial miss is never silent. Empty for other search types.
|
|
265
288
|
const noticeParts = [];
|
|
@@ -270,20 +293,30 @@ export const searchCompounds = tool('pubchem_search_compounds', {
|
|
|
270
293
|
for (const c of collisions) {
|
|
271
294
|
noticeParts.push(`Identifiers ${c.identifiers.join(', ')} all resolved to CID ${c.cid}; the result row echoes only "${identifierMap.get(c.cid)}" for it.`);
|
|
272
295
|
}
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
296
|
+
if (pagedCids.length === 0) {
|
|
297
|
+
// An empty page is either "nothing matched" or "the offset ran past the matches" —
|
|
298
|
+
// say which, and name the bound the caller can page back inside.
|
|
299
|
+
if (observedTotal === 0) {
|
|
300
|
+
if (noticeParts.length === 0) {
|
|
301
|
+
noticeParts.push(`No compounds matched the ${input.searchType} search. Try a different identifier, broaden the formula, lower the similarity threshold, or verify the SMILES/CID.`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
// Reachable only with an exact total: a saturated bounded search observed
|
|
306
|
+
// offset + maxResults + 1 records, so its page is never empty.
|
|
307
|
+
noticeParts.push(`offset ${input.offset} is past the ${observedTotal} match(es) found. Pass an offset below ${observedTotal}.`);
|
|
308
|
+
}
|
|
309
|
+
ctx.enrich.notice(noticeParts.join(' '));
|
|
277
310
|
}
|
|
278
|
-
else if (
|
|
311
|
+
else if (hasMore) {
|
|
279
312
|
// Truncated: fold any identifier notice into the truncation guidance (notice is
|
|
280
313
|
// last-wins, so compose rather than emit two). Without an exact total there is no
|
|
281
|
-
// "of N" to quote — say more exist and
|
|
314
|
+
// "of N" to quote — say more exist, and still hand over the next offset.
|
|
282
315
|
const truncationGuidance = totalIsExact
|
|
283
|
-
? `Showing ${
|
|
284
|
-
: `Showing ${
|
|
316
|
+
? `Showing matches ${input.offset + 1}-${nextOffset} of ${observedTotal}. Pass offset=${nextOffset} for the next page.`
|
|
317
|
+
: `Showing matches ${input.offset + 1}-${nextOffset}; more exist, but PubChem reports no match count for a ${input.searchType} search. Pass offset=${nextOffset} for the next page.`;
|
|
285
318
|
ctx.enrich.truncated({
|
|
286
|
-
shown:
|
|
319
|
+
shown: pagedCids.length,
|
|
287
320
|
cap: input.maxResults,
|
|
288
321
|
guidance: noticeParts.length > 0
|
|
289
322
|
? `${noticeParts.join(' ')} ${truncationGuidance}`
|
|
@@ -295,11 +328,11 @@ export const searchCompounds = tool('pubchem_search_compounds', {
|
|
|
295
328
|
}
|
|
296
329
|
// Optionally hydrate with properties
|
|
297
330
|
let propsMap;
|
|
298
|
-
if (input.properties && input.properties.length > 0 &&
|
|
299
|
-
const rows = await client.getProperties(
|
|
331
|
+
if (input.properties && input.properties.length > 0 && pagedCids.length > 0) {
|
|
332
|
+
const rows = await client.getProperties(pagedCids, input.properties);
|
|
300
333
|
propsMap = new Map(rows.map((r) => [r.CID, r]));
|
|
301
334
|
}
|
|
302
|
-
const results =
|
|
335
|
+
const results = pagedCids.map((cid) => {
|
|
303
336
|
const result = { cid };
|
|
304
337
|
const identifier = identifierMap.get(cid);
|
|
305
338
|
if (identifier)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-compounds.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-compounds.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5B,YAAY;IACZ,SAAS;IACT,cAAc;IACd,gBAAgB;IAChB,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAClE,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,CA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CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,qBAAqB,IAAI,MAAM,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5E,KAAK,CAAC,IAAI,CACR,2BAA2B,MAAM,CAAC,qBAAqB,CAAC,MAAM,MAAM,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9G,CAAC;QACJ,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"}
|
|
1
|
+
{"version":3,"file":"search-compounds.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-compounds.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5B,YAAY;IACZ,SAAS;IACT,cAAc;IACd,gBAAgB;IAChB,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAClE,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAChD,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAuD,CAAC,CAAC;AAErF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,0BAA0B,EAAE;IA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C,qBAAqB,CAAC,MAAM,MAAM,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9G,CAAC;QACJ,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"}
|
|
@@ -73,10 +73,11 @@ export declare class PubChemClient {
|
|
|
73
73
|
searchAssaysByTarget(targetType: string, query: string): Promise<number[]>;
|
|
74
74
|
getEntitySummary(entityType: string, identifier: string | number): Promise<Record<string, unknown> | null>;
|
|
75
75
|
/** Fetch drug-drug, drug-food, and/or chemical-target interactions for a compound.
|
|
76
|
-
* Drug-drug and target data live in PubChem SDQ external tables (drugbankddi,
|
|
77
|
-
*
|
|
78
|
-
* at
|
|
79
|
-
|
|
76
|
+
* Drug-drug and target data live in PubChem SDQ external tables (drugbankddi, bioactivity);
|
|
77
|
+
* drug-food is inline PUG View text. Each kind reads a window of `maxEntries` entries
|
|
78
|
+
* starting at `offset` records into that kind's own stream; absent data for a kind
|
|
79
|
+
* contributes an empty page rather than erroring. */
|
|
80
|
+
getInteractions(cid: number, kinds: Array<'drug-drug' | 'drug-food' | 'target'>, maxEntries: number, offset: number): Promise<InteractionsResult>;
|
|
80
81
|
private getInteractionsForKind;
|
|
81
82
|
private getDrugDrugInteractions;
|
|
82
83
|
/** Chemical-target binding/activity from PubChem's `bioactivity` SDQ collection (BindingDB,
|
|
@@ -84,15 +85,35 @@ export declare class PubChemClient {
|
|
|
84
85
|
* compound; the `consolidatedcompoundtarget` collection used previously is gene-indexed, so
|
|
85
86
|
* its `cid` filter was silently ignored — every CID returned the same default compound (#20).
|
|
86
87
|
* Only rows naming a molecular target are returned; untargeted assay outcomes are the domain
|
|
87
|
-
* of pubchem_get_bioactivity.
|
|
88
|
+
* of pubchem_get_bioactivity.
|
|
89
|
+
*
|
|
90
|
+
* Because most rows are dropped, the page position is an index into the activity records, not
|
|
91
|
+
* into the entries returned — the walk records exactly how many rows it read so the next page
|
|
92
|
+
* resumes at the first unread one. */
|
|
88
93
|
private getTargetInteractions;
|
|
89
94
|
private getDrugFoodInteractions;
|
|
90
95
|
/** Query a PubChem SDQ external table for a single CID, projecting only the columns the
|
|
91
96
|
* caller maps. Projection keeps payloads small and excludes the free-text `citations` column
|
|
92
|
-
* whose unescaped quotes make PubChem emit invalid JSON (#20).
|
|
93
|
-
*
|
|
94
|
-
*
|
|
97
|
+
* whose unescaped quotes make PubChem emit invalid JSON (#20).
|
|
98
|
+
*
|
|
99
|
+
* Uses SDQ's `select` projection rather than `download`: the `SDQOutputSet` envelope it
|
|
100
|
+
* answers with carries `totalCount` — the records matching the query across all pages —
|
|
101
|
+
* beside the requested window, which is the only way to tell a full page from the last one.
|
|
102
|
+
* `start` is 1-based upstream; `offset` here is zero-based like every other paging input.
|
|
103
|
+
*
|
|
104
|
+
* Returns an empty page on not-found. A rejected query is reported, never read as "no data":
|
|
105
|
+
* SDQ answers a malformed query with a 5xx that the shared HTTP core already classifies and
|
|
106
|
+
* throws, and the `status.error` check covers the same rejection arriving inside a 2xx body.
|
|
107
|
+
* An unparseable body throws with the collection and a body snippet attached, so per-kind
|
|
108
|
+
* isolation can name what failed. */
|
|
95
109
|
private fetchSdq;
|
|
110
|
+
/** Resolve a kind's record total for the page just fetched.
|
|
111
|
+
*
|
|
112
|
+
* SDQ reports `totalCount` alongside every non-empty page, but a `start` past the last record
|
|
113
|
+
* answers `totalCount` 0 — so an offset that overshoots would otherwise report "no records"
|
|
114
|
+
* for a compound that has thousands. A one-row probe from the top recovers the real bound,
|
|
115
|
+
* and only runs on that case. */
|
|
116
|
+
private resolveSdqTotal;
|
|
96
117
|
/** Fetch the default 3D conformer as raw V2000 SDF text. Throws a typed not-found when
|
|
97
118
|
* PubChem has no computed 3D coordinates (large molecules, mixtures, undefined salts). */
|
|
98
119
|
getSdf3d(cid: number): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pubchem-client.d.ts","sourceRoot":"","sources":["../../../src/services/pubchem/pubchem-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAGV,cAAc,EAEd,sBAAsB,
|
|
1
|
+
{"version":3,"file":"pubchem-client.d.ts","sourceRoot":"","sources":["../../../src/services/pubchem/pubchem-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAGV,cAAc,EAEd,sBAAsB,EAMtB,kBAAkB,EAMlB,YAAY,EAIb,MAAM,YAAY,CAAC;AA8ZpB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+C;IACvE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoD;IAC7E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuD;IAC/E,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsB;IAIlD;;;;6CAIyC;YAC3B,aAAa;YA8Cb,SAAS;YAKT,WAAW;IAKzB,sFAAsF;YACxE,SAAS;IAOvB;;;;;;gEAM4D;YAC9C,SAAS;IAWvB;;;iGAG6F;YAC/E,WAAW;IAsBzB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAE5C;IAED,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAMhD;IAED,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIpD;IAED;;;;;;;;;;kEAU8D;IAC9D,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQ3F;IAED;qEACiE;IACjE,iBAAiB,CACf,IAAI,EAAE,cAAc,GAAG,gBAAgB,GAAG,YAAY,EACtD,KAAK,EAAE,M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AgB,CACpB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAAG,MAAM,GAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAgCzC;IAID;;;;yDAIqD;IAC/C,eAAe,CACnB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,CAAC,WAAW,GAAG,WAAW,GAAG,QAAQ,CAAC,EAClD,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,kBAAkB,CAAC,CA0B7B;IAED,OAAO,CAAC,sBAAsB;YAgBhB,uBAAuB;IA2BrC;;;;;;;;;0CASsC;YACxB,qBAAqB;YAqDrB,uBAAuB;IAsCrC;;;;;;;;;;;;;yCAaqC;YACvB,QAAQ;IAkDtB;;;;;qCAKiC;YACnB,eAAe;IAc7B;8FAC0F;IACpF,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe3C;IAED,2FAA2F;IACrF,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAUpD;CACF;AAMD,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAIhD"}
|
|
@@ -908,19 +908,25 @@ export class PubChemClient {
|
|
|
908
908
|
}
|
|
909
909
|
// ── Interactions ────────────────────────────────────────────────
|
|
910
910
|
/** Fetch drug-drug, drug-food, and/or chemical-target interactions for a compound.
|
|
911
|
-
* Drug-drug and target data live in PubChem SDQ external tables (drugbankddi,
|
|
912
|
-
*
|
|
913
|
-
* at
|
|
914
|
-
|
|
911
|
+
* Drug-drug and target data live in PubChem SDQ external tables (drugbankddi, bioactivity);
|
|
912
|
+
* drug-food is inline PUG View text. Each kind reads a window of `maxEntries` entries
|
|
913
|
+
* starting at `offset` records into that kind's own stream; absent data for a kind
|
|
914
|
+
* contributes an empty page rather than erroring. */
|
|
915
|
+
async getInteractions(cid, kinds, maxEntries, offset) {
|
|
915
916
|
// Per-kind isolation: a failure in one source (upstream parse error, timeout, network)
|
|
916
917
|
// must not discard the kinds that succeeded. Failures are reported, not thrown (#21).
|
|
917
|
-
|
|
918
|
+
// Page state is recorded per kind from that kind's own result, so a failing kind leaves
|
|
919
|
+
// the others' continuation signals untouched rather than zeroing them.
|
|
920
|
+
const settled = await Promise.allSettled(kinds.map((kind) => this.getInteractionsForKind(cid, kind, maxEntries, offset)));
|
|
918
921
|
const entries = [];
|
|
922
|
+
const pages = [];
|
|
919
923
|
const failedKinds = [];
|
|
920
924
|
kinds.forEach((kind, i) => {
|
|
921
925
|
const result = settled[i];
|
|
922
926
|
if (result?.status === 'fulfilled') {
|
|
923
|
-
entries
|
|
927
|
+
const { entries: kindEntries, totalRecords, recordsConsumed } = result.value;
|
|
928
|
+
entries.push(...kindEntries);
|
|
929
|
+
pages.push({ kind, returnedCount: kindEntries.length, totalRecords, recordsConsumed });
|
|
924
930
|
}
|
|
925
931
|
else if (result?.status === 'rejected') {
|
|
926
932
|
const reason = result.reason;
|
|
@@ -930,20 +936,20 @@ export class PubChemClient {
|
|
|
930
936
|
});
|
|
931
937
|
}
|
|
932
938
|
});
|
|
933
|
-
return { entries, failedKinds };
|
|
939
|
+
return { entries, pages, failedKinds };
|
|
934
940
|
}
|
|
935
|
-
getInteractionsForKind(cid, kind, maxEntries) {
|
|
941
|
+
getInteractionsForKind(cid, kind, maxEntries, offset) {
|
|
936
942
|
switch (kind) {
|
|
937
943
|
case 'drug-drug':
|
|
938
|
-
return this.getDrugDrugInteractions(cid, maxEntries);
|
|
944
|
+
return this.getDrugDrugInteractions(cid, maxEntries, offset);
|
|
939
945
|
case 'drug-food':
|
|
940
|
-
return this.getDrugFoodInteractions(cid, maxEntries);
|
|
946
|
+
return this.getDrugFoodInteractions(cid, maxEntries, offset);
|
|
941
947
|
case 'target':
|
|
942
|
-
return this.getTargetInteractions(cid, maxEntries);
|
|
948
|
+
return this.getTargetInteractions(cid, maxEntries, offset);
|
|
943
949
|
}
|
|
944
950
|
}
|
|
945
|
-
async getDrugDrugInteractions(cid, maxEntries) {
|
|
946
|
-
const rows = await this.fetchSdq('drugbankddi', cid, ['cid', 'name2', 'descr'], maxEntries);
|
|
951
|
+
async getDrugDrugInteractions(cid, maxEntries, offset) {
|
|
952
|
+
const { rows, totalCount } = await this.fetchSdq('drugbankddi', cid, ['cid', 'name2', 'descr'], maxEntries, offset);
|
|
947
953
|
const entries = [];
|
|
948
954
|
for (const row of rows) {
|
|
949
955
|
const text = typeof row.descr === 'string' ? row.descr : '';
|
|
@@ -954,21 +960,35 @@ export class PubChemClient {
|
|
|
954
960
|
entry.partner = row.name2;
|
|
955
961
|
entries.push(entry);
|
|
956
962
|
}
|
|
957
|
-
return
|
|
963
|
+
return {
|
|
964
|
+
entries,
|
|
965
|
+
totalRecords: await this.resolveSdqTotal('drugbankddi', cid, rows.length, totalCount, offset),
|
|
966
|
+
recordsConsumed: rows.length,
|
|
967
|
+
};
|
|
958
968
|
}
|
|
959
969
|
/** Chemical-target binding/activity from PubChem's `bioactivity` SDQ collection (BindingDB,
|
|
960
970
|
* ChEMBL, and others). That collection is cid-keyed and scopes correctly to the requested
|
|
961
971
|
* compound; the `consolidatedcompoundtarget` collection used previously is gene-indexed, so
|
|
962
972
|
* its `cid` filter was silently ignored — every CID returned the same default compound (#20).
|
|
963
973
|
* Only rows naming a molecular target are returned; untargeted assay outcomes are the domain
|
|
964
|
-
* of pubchem_get_bioactivity.
|
|
965
|
-
|
|
974
|
+
* of pubchem_get_bioactivity.
|
|
975
|
+
*
|
|
976
|
+
* Because most rows are dropped, the page position is an index into the activity records, not
|
|
977
|
+
* into the entries returned — the walk records exactly how many rows it read so the next page
|
|
978
|
+
* resumes at the first unread one. */
|
|
979
|
+
async getTargetInteractions(cid, maxEntries, offset) {
|
|
966
980
|
// `targetname` is sparse (most rows are untargeted assay outcomes), so oversample and keep
|
|
967
981
|
// the target-bearing rows, most-potent-first.
|
|
968
982
|
const window = Math.min(Math.max(maxEntries * 4, 20), 100);
|
|
969
|
-
const rows = await this.fetchSdq('bioactivity', cid, ['cid', 'targetname', 'acname', 'acqualifier', 'acvalue', 'aidsrcname'], window, ['acvalue,asc']);
|
|
983
|
+
const { rows, totalCount } = await this.fetchSdq('bioactivity', cid, ['cid', 'targetname', 'acname', 'acqualifier', 'acvalue', 'aidsrcname'], window, offset, ['acvalue,asc']);
|
|
970
984
|
const entries = [];
|
|
985
|
+
// Collapse duplicate measurements of the same target/value reported across assays.
|
|
986
|
+
const seen = new Set();
|
|
987
|
+
let recordsConsumed = 0;
|
|
971
988
|
for (const row of rows) {
|
|
989
|
+
if (entries.length === maxEntries)
|
|
990
|
+
break;
|
|
991
|
+
recordsConsumed++;
|
|
972
992
|
const target = typeof row.targetname === 'string' ? row.targetname.trim() : '';
|
|
973
993
|
if (!target)
|
|
974
994
|
continue;
|
|
@@ -981,53 +1001,79 @@ export class PubChemClient {
|
|
|
981
1001
|
// assaysummary endpoint's "Activity Value [uM]" column. We assert that documented µM
|
|
982
1002
|
// convention here — it is not a per-row unit fetched from SDQ (none exists to fetch).
|
|
983
1003
|
const activity = acname && acvalue ? `${acname} ${qualifier} ${acvalue} uM`.replace(/\s+/g, ' ').trim() : '';
|
|
1004
|
+
const text = activity || 'Activity reported';
|
|
1005
|
+
const key = `${target}|${text}`;
|
|
1006
|
+
if (seen.has(key))
|
|
1007
|
+
continue;
|
|
1008
|
+
seen.add(key);
|
|
984
1009
|
entries.push({
|
|
985
1010
|
kind: 'target',
|
|
986
1011
|
source: typeof row.aidsrcname === 'string' && row.aidsrcname ? row.aidsrcname : 'PubChem',
|
|
987
1012
|
partner: target,
|
|
988
|
-
text
|
|
1013
|
+
text,
|
|
989
1014
|
});
|
|
990
1015
|
}
|
|
991
|
-
|
|
992
|
-
|
|
1016
|
+
return {
|
|
1017
|
+
entries,
|
|
1018
|
+
totalRecords: await this.resolveSdqTotal('bioactivity', cid, rows.length, totalCount, offset),
|
|
1019
|
+
recordsConsumed,
|
|
1020
|
+
};
|
|
993
1021
|
}
|
|
994
|
-
async getDrugFoodInteractions(cid, maxEntries) {
|
|
1022
|
+
async getDrugFoodInteractions(cid, maxEntries, offset) {
|
|
1023
|
+
const empty = { entries: [], totalRecords: 0, recordsConsumed: 0 };
|
|
995
1024
|
try {
|
|
996
1025
|
const data = await this.fetchJson(`${this.viewBase}/data/compound/${cid}/JSON?heading=Drug-Food+Interactions`);
|
|
997
1026
|
const sections = data.Record.Section;
|
|
998
1027
|
if (!sections)
|
|
999
|
-
return
|
|
1028
|
+
return empty;
|
|
1000
1029
|
const section = findSection(sections, 'Drug-Food Interactions');
|
|
1001
1030
|
if (!section)
|
|
1002
|
-
return
|
|
1031
|
+
return empty;
|
|
1003
1032
|
const refToSource = new Map();
|
|
1004
1033
|
for (const ref of data.Record.Reference ?? []) {
|
|
1005
1034
|
refToSource.set(ref.ReferenceNumber, ref.SourceName);
|
|
1006
1035
|
}
|
|
1036
|
+
// PUG View returns the whole section inline, so the deduped item list is the complete
|
|
1037
|
+
// record stream and the page is a plain slice of it.
|
|
1007
1038
|
const items = dedupByKey(extractDescriptionItems(section), descriptionKey);
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1039
|
+
const page = items.slice(offset, offset + maxEntries);
|
|
1040
|
+
return {
|
|
1041
|
+
entries: page.map((item) => {
|
|
1042
|
+
const source = item.refNum != null ? refToSource.get(item.refNum) : undefined;
|
|
1043
|
+
return { kind: 'drug-food', source: source ?? 'PubChem', text: item.text };
|
|
1044
|
+
}),
|
|
1045
|
+
totalRecords: items.length,
|
|
1046
|
+
recordsConsumed: page.length,
|
|
1047
|
+
};
|
|
1012
1048
|
}
|
|
1013
1049
|
catch (error) {
|
|
1014
1050
|
if (isNotFound(error))
|
|
1015
|
-
return
|
|
1051
|
+
return empty;
|
|
1016
1052
|
throw error;
|
|
1017
1053
|
}
|
|
1018
1054
|
}
|
|
1019
1055
|
/** Query a PubChem SDQ external table for a single CID, projecting only the columns the
|
|
1020
1056
|
* caller maps. Projection keeps payloads small and excludes the free-text `citations` column
|
|
1021
|
-
* whose unescaped quotes make PubChem emit invalid JSON (#20).
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1024
|
-
|
|
1057
|
+
* whose unescaped quotes make PubChem emit invalid JSON (#20).
|
|
1058
|
+
*
|
|
1059
|
+
* Uses SDQ's `select` projection rather than `download`: the `SDQOutputSet` envelope it
|
|
1060
|
+
* answers with carries `totalCount` — the records matching the query across all pages —
|
|
1061
|
+
* beside the requested window, which is the only way to tell a full page from the last one.
|
|
1062
|
+
* `start` is 1-based upstream; `offset` here is zero-based like every other paging input.
|
|
1063
|
+
*
|
|
1064
|
+
* Returns an empty page on not-found. A rejected query is reported, never read as "no data":
|
|
1065
|
+
* SDQ answers a malformed query with a 5xx that the shared HTTP core already classifies and
|
|
1066
|
+
* throws, and the `status.error` check covers the same rejection arriving inside a 2xx body.
|
|
1067
|
+
* An unparseable body throws with the collection and a body snippet attached, so per-kind
|
|
1068
|
+
* isolation can name what failed. */
|
|
1069
|
+
async fetchSdq(collection, cid, columns, limit, offset = 0, order) {
|
|
1070
|
+
const empty = { rows: [], totalCount: 0 };
|
|
1025
1071
|
const query = JSON.stringify({
|
|
1026
|
-
|
|
1072
|
+
select: columns,
|
|
1027
1073
|
collection,
|
|
1028
1074
|
where: { ands: [{ cid: String(cid) }] },
|
|
1029
1075
|
...(order ? { order } : {}),
|
|
1030
|
-
start: 1,
|
|
1076
|
+
start: offset + 1,
|
|
1031
1077
|
limit,
|
|
1032
1078
|
});
|
|
1033
1079
|
const url = `${this.sdqBase}?infmt=json&outfmt=json&query=${encodeURIComponent(query)}`;
|
|
@@ -1037,16 +1083,35 @@ export class PubChemClient {
|
|
|
1037
1083
|
}
|
|
1038
1084
|
catch (error) {
|
|
1039
1085
|
if (isNotFound(error))
|
|
1040
|
-
return
|
|
1086
|
+
return empty;
|
|
1041
1087
|
throw error;
|
|
1042
1088
|
}
|
|
1089
|
+
let parsed;
|
|
1043
1090
|
try {
|
|
1044
|
-
|
|
1045
|
-
return Array.isArray(data) ? data : [];
|
|
1091
|
+
parsed = JSON.parse(body);
|
|
1046
1092
|
}
|
|
1047
1093
|
catch {
|
|
1048
1094
|
throw new McpError(JsonRpcErrorCode.ServiceUnavailable, `PubChem SDQ returned unparseable JSON for collection "${collection}"`, { collection, cid, snippet: body.slice(0, 200) });
|
|
1049
1095
|
}
|
|
1096
|
+
const set = parsed.SDQOutputSet?.[0];
|
|
1097
|
+
if (!set)
|
|
1098
|
+
return empty;
|
|
1099
|
+
if (set.status?.error) {
|
|
1100
|
+
throw new McpError(JsonRpcErrorCode.ServiceUnavailable, `PubChem SDQ rejected the query for collection "${collection}": ${set.status.error}`, { collection, cid, sdqError: set.status.error });
|
|
1101
|
+
}
|
|
1102
|
+
return { rows: set.rows ?? [], totalCount: set.totalCount ?? 0 };
|
|
1103
|
+
}
|
|
1104
|
+
/** Resolve a kind's record total for the page just fetched.
|
|
1105
|
+
*
|
|
1106
|
+
* SDQ reports `totalCount` alongside every non-empty page, but a `start` past the last record
|
|
1107
|
+
* answers `totalCount` 0 — so an offset that overshoots would otherwise report "no records"
|
|
1108
|
+
* for a compound that has thousands. A one-row probe from the top recovers the real bound,
|
|
1109
|
+
* and only runs on that case. */
|
|
1110
|
+
async resolveSdqTotal(collection, cid, rowsReturned, reportedTotal, offset) {
|
|
1111
|
+
if (rowsReturned > 0 || offset === 0)
|
|
1112
|
+
return reportedTotal;
|
|
1113
|
+
const { totalCount } = await this.fetchSdq(collection, cid, ['cid'], 1);
|
|
1114
|
+
return totalCount;
|
|
1050
1115
|
}
|
|
1051
1116
|
// ── 3D Structure ────────────────────────────────────────────────
|
|
1052
1117
|
/** Fetch the default 3D conformer as raw V2000 SDF text. Throws a typed not-found when
|