Get Compound Cross-References
pubchem_get_compound_xrefsRetrieve external database cross-references for a PubChem compound, including PubMed citations, patents, gene associations, CAS/EC and registry numbers. Page results per type with offset to reach IDs past a page.
Instructions
Get external database cross-references for a compound: PubMed citations, patent IDs, gene associations, CAS and EC numbers with the number of source records that deposited each, other registry numbers, and taxonomy IDs. Results are paged per type — capped at maxPerType with the total count reported; reach the IDs past a page with offset. PubMed IDs come highest (most recently assigned) first and the other numeric types in ascending order; CAS and EC come most-attested first; the other string IDs keep PubChem's order. A type that fails to load is named in failedTypes while the others still return; the call fails only when a type fails and no type other than ProteinGI (which PubChem no longer serves) loads.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"cid": "<cid>",
"xrefTypes": "<xrefTypes>"
},
"name": "pubchem_get_compound_xrefs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cid | Yes | PubChem Compound ID. Resolve from name/SMILES with pubchem_search_compounds. | |
| offset | No | Zero-based index of the first ID to return within each xref type. The same offset is applied to every requested type. Pass the nextOffset from a previous call to read the following page. Default: 0. | |
| xrefTypes | Yes | Cross-reference types to retrieve. String IDs: CAS (the CAS Registry Numbers deposited for this compound, most-attested first, each with the number of source records that deposited it — the first is the value most source records agree on), EC (European Community numbers, ordered and counted the same way), RN (every registry number PubChem associates with the record, unranked: the CAS number alongside deprecated and related CAS RNs, CAS RNs of other substances mapped to the structure, and EC numbers), RegistryID (DSSTox/EPA registry numbers), PatentID. Numeric IDs: PubMedID, GeneID (NCBI Gene — use it for gene/protein associations), ProteinGI (legacy NCBI Protein GI; PubChem currently returns no data for it, so use GeneID instead), TaxonomyID. | |
| maxPerType | No | Max IDs to return per xref type per page. The per-call cap is 500: a larger value (up to 1000) returns 500 per type and is reported in cappedInputs. A compound may have thousands of PubMed references; use offset to reach the ones past this page. Total count always reported. Default: 50. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cid | No | PubChem Compound ID. | |
| error | No | Present when the call failed. Absent on success. | |
| xrefs | No | Cross-references grouped by type, one group per requested type that loaded. A type listed in failedTypes is absent — its IDs are unknown, not empty. | |
| notice | No | Guidance when a type failed to load, when every requested xref type returned zero IDs, when the offset runs past every type, when further pages remain, or when ProteinGI came back empty (PubChem serves no ProteinGI data). Absent when this page is complete and non-empty. | |
| offset | No | Zero-based index of the first ID returned within each type. | |
| truncated | No | True when at least one requested type has IDs remaining past this page. Which types, and how many IDs each holds in total, is in xrefs[].truncated / xrefs[].totalAvailable. | |
| nextOffset | No | Offset to pass on the next call to continue past this page. Omitted when no requested type has further IDs. | |
| failedTypes | No | Requested xref types that could not be retrieved (comma-separated). The returned groups cover the types that loaded. A retry can recover a type that failed transiently (a timeout, network error, rate limit, or 5xx), and the notice names those; a type PubChem rejected fails the same way again. | |
| cappedInputs | No | Inputs that asked for more than their per-call cap, with the value requested and the value served. An ID batch lists the IDs past the cap in unprocessed. Omitted when every input was within its cap. |