Skip to main content
Glama

Get Compound Cross-References

pubchem_get_compound_xrefs
Read-onlyIdempotent

Retrieve external database cross-references by PubChem CID, including PubMed citations, patents, gene associations, CAS/EC and registry numbers, and taxonomy IDs, with paged results per type.

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

NameRequiredDescriptionDefault
cidYesPubChem Compound ID. Resolve from name/SMILES with pubchem_search_compounds.
offsetNoZero-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.
xrefTypesYesCross-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 (NCBI Taxonomy IDs of organisms PubChem links the compound to, often laboratory and model organisms and sometimes a source organism, and not a list of the organisms it occurs in).
maxPerTypeNoMax 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

NameRequiredDescriptionDefault
cidNoPubChem Compound ID.
errorNoPresent when the call failed. Absent on success.
xrefsNoCross-references grouped by type, one group per requested type that loaded. A type listed in failedTypes is absent — its IDs are unknown, not empty.
noticeNoGuidance 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.
offsetNoZero-based index of the first ID returned within each type.
truncatedNoTrue 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.
nextOffsetNoOffset to pass on the next call to continue past this page. Omitted when no requested type has further IDs.
failedTypesNoRequested 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.
cappedInputsNoInputs 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.9.1
    • changedInput schema / properties / xrefTypes / description
      Previous value: -"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."New value: +"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 (NCBI Taxonomy IDs of organisms PubChem links the compound to, often laboratory and model organisms and sometimes a source organism, and not a list of the organisms it occurs in)."
  2. Changed8 schema fields changedv0.7.1
    • changedInput schema / properties / xrefTypes / description
      Previous value: -"Cross-reference types to retrieve. String IDs: RegistryID (DSSTox/EPA registry numbers), RN (CAS numbers), PatentID. Numeric IDs: PubMedID, GeneID (NCBI Gene), ProteinGI (legacy NCBI Protein GI), TaxonomyID."New value: +"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."
    • changedInput schema / properties / xrefTypes / items / enum
      Previous value: -[
      -  "RegistryID",
      -  "RN",
      -  "PubMedID",
      -  "PatentID",
      -  "GeneID",
      -  "ProteinGI",
      -  "TaxonomyID"
      -]New value: +[
      +  "RegistryID",
      +  "RN",
      +  "PubMedID",
      +  "PatentID",
      +  "GeneID",
      +  "ProteinGI",
      +  "TaxonomyID",
      +  "CAS",
      +  "EC"
      +]
    • addedOutput schema / properties / failedTypes
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery guidance when every requested xref type returned zero IDs, when the offset runs past every type, or when further pages remain. Absent when this page is complete and non-empty."New value: +"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."
    • changedOutput schema / properties / xrefs / description
      Previous value: -"Cross-references grouped by type."New value: +"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."
    • changedOutput schema / properties / xrefs / items / properties / ids / description
      Previous value: -"Cross-reference IDs on this page (window of offset + maxPerType). PubMedID is sorted numerically descending, so page one holds the highest, most recently assigned PMIDs; GeneID, ProteinGI and TaxonomyID numerically ascending; RegistryID, RN and PatentID keep PubChem's order."New value: +"Cross-reference IDs on this page (window of offset + maxPerType). PubMedID is sorted numerically descending, so page one holds the highest, most recently assigned PMIDs; GeneID, ProteinGI and TaxonomyID numerically ascending; CAS and EC by the number of source records that deposited each, most first (ties in PubChem's order), so ids[0] is the value most source records agree on; RegistryID, RN and PatentID keep PubChem's order."
    • addedOutput schema / properties / xrefs / items / properties / sourceCounts
      Added value: +{
      +  "description": "CAS and EC only: how many source records deposited each ID on this page, aligned with ids — sourceCounts[i] is the count for ids[i]. One source can deposit several records, so this counts records, not distinct source names. More than one ID means the source records disagree; the counts show by how much.",
      +  "items": {
      +    "description": "Number of source records that deposited the ID at this index.",
      +    "type": "number"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / xrefs / items / properties / type / description
      Previous value: -"Cross-reference type: RegistryID, RN, PubMedID, PatentID, GeneID, ProteinGI, or TaxonomyID."New value: +"Cross-reference type: CAS, EC, RN, RegistryID, PubMedID, PatentID, GeneID, ProteinGI, or TaxonomyID. PubChem currently returns no data for ProteinGI; GeneID carries gene/protein associations."
  3. Changed5 schema fields changedv0.7.0
    • changedInput schema / properties / cid / maximum
      Previous value: -9007199254740991New value: +2147483647
    • changedInput schema / properties / maxPerType / description
      Previous value: -"Max IDs to return per xref type per page (1-500). A compound may have thousands of PubMed references; use offset to reach the ones past this page. Total count always reported. Default: 50."New value: +"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."
    • changedInput schema / properties / maxPerType / maximum
      Previous value: -500New value: +1000
    • addedOutput schema / properties / cappedInputs
      Added value: +{
      +  "description": "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.",
      +  "items": {
      +    "additionalProperties": false,
      +    "description": "One input served at its per-call cap.",
      +    "properties": {
      +      "input": {
      +        "description": "Input name, e.g. \"maxResults\" or \"cids\".",
      +        "type": "string"
      +      },
      +      "requested": {
      +        "description": "Value requested: the page size, or the number of IDs in the batch.",
      +        "type": "number"
      +      },
      +      "served": {
      +        "description": "Value served: the per-call cap.",
      +        "type": "number"
      +      },
      +      "unprocessed": {
      +        "description": "ID batches only: IDs past the cap, listed in unprocessed in input order.",
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "input",
      +      "requested",
      +      "served"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / xrefs / items / properties / ids / description
      Previous value: -"Cross-reference IDs on this page (window of offset + maxPerType)."New value: +"Cross-reference IDs on this page (window of offset + maxPerType). PubMedID is sorted numerically descending, so page one holds the highest, most recently assigned PMIDs; GeneID, ProteinGI and TaxonomyID numerically ascending; RegistryID, RN and PatentID keep PubChem's order."
  4. Changed2 schema fields changedv0.6.5
    • removedInput schema / properties / cid / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / cid / minimum
      Added value: +1
  5. Changed7 schema fields changedv0.6.1
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "cid",
      +      "xrefs",
      +      "offset",
      +      "truncated"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode.",
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "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.",
      +  "type": "boolean"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "cid",
      -  "xrefs",
      -  "offset"
      -]
  6. Changed10 schema fields changedv0.6.0
    • changedInput schema / properties / maxPerType / description
      Previous value: -"Max IDs to return per xref type (1-500). A compound may have thousands of PubMed references. Total count always reported. Default: 50."New value: +"Max IDs to return per xref type per page (1-500). A compound may have thousands of PubMed references; use offset to reach the ones past this page. Total count always reported. Default: 50."
    • changedInput schema / properties / maxPerType / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / offset
      Added value: +{
      +  "default": 0,
      +  "description": "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.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedOutput schema / properties / nextOffset
      Added value: +{
      +  "description": "Offset to pass on the next call to continue past this page. Omitted when no requested type has further IDs.",
      +  "type": "number"
      +}
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery guidance when every requested xref type returned zero IDs — hints to verify the CID. Absent when any cross-references were found."New value: +"Recovery guidance when every requested xref type returned zero IDs, when the offset runs past every type, or when further pages remain. Absent when this page is complete and non-empty."
    • addedOutput schema / properties / offset
      Added value: +{
      +  "description": "Zero-based index of the first ID returned within each type.",
      +  "type": "number"
      +}
    • changedOutput schema / properties / xrefs / items / properties / ids / description
      Previous value: -"Cross-reference IDs (capped by maxPerType)."New value: +"Cross-reference IDs on this page (window of offset + maxPerType)."
    • changedOutput schema / properties / xrefs / items / properties / totalAvailable / description
      Previous value: -"Total IDs available before truncation."New value: +"Total IDs available for this type, across all pages."
    • changedOutput schema / properties / xrefs / items / properties / truncated / description
      Previous value: -"Whether results were truncated."New value: +"True when IDs for this type remain past the current page."
    • changedOutput schema / required
      Previous value: -[
      -  "cid",
      -  "xrefs"
      -]New value: +[
      +  "cid",
      +  "xrefs",
      +  "offset"
      +]
  7. Changed1 schema field changedv0.2.5
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Recovery guidance when every requested xref type returned zero IDs — hints to verify the CID. Absent when any cross-references were found.",
      +  "type": "string"
      +}
  8. Changed7 schema fields changedv0.1.22
    • changedInput schema / properties / cid / description
      Previous value: -"PubChem Compound ID."New value: +"PubChem Compound ID. Resolve from name/SMILES with pubchem_search_compounds."
    • changedInput schema / properties / maxPerType / description
      Previous value: -"Max IDs to return per xref type (1-500). A compound may have thousands of PubMed references — this cap prevents bloat. Total count always reported. Default: 50."New value: +"Max IDs to return per xref type (1-500). A compound may have thousands of PubMed references. Total count always reported. Default: 50."
    • changedInput schema / properties / xrefTypes / description
      Previous value: -"Cross-reference types to retrieve. Options: RegistryID, RN (CAS numbers), PubMedID, PatentID, GeneID, ProteinGI, TaxonomyID."New value: +"Cross-reference types to retrieve. String IDs: RegistryID (DSSTox/EPA registry numbers), RN (CAS numbers), PatentID. Numeric IDs: PubMedID, GeneID (NCBI Gene), ProteinGI (legacy NCBI Protein GI), TaxonomyID."
    • addedOutput schema / properties / xrefs / items / description
      Added value: +"Cross-reference group for one type."
    • changedOutput schema / properties / xrefs / items / properties / ids / items / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  }
      -]New value: +[
      +  {
      +    "description": "String-form cross-reference ID (e.g. CAS number, patent).",
      +    "type": "string"
      +  },
      +  {
      +    "description": "Numeric cross-reference ID (e.g. PubMed ID, Gene ID).",
      +    "type": "number"
      +  }
      +]
    • addedOutput schema / properties / xrefs / items / properties / ids / items / description
      Added value: +"Cross-reference identifier — string or number depending on type."
    • changedOutput schema / properties / xrefs / items / properties / type / description
      Previous value: -"Cross-reference type."New value: +"Cross-reference type: RegistryID, RN, PubMedID, PatentID, GeneID, ProteinGI, or TaxonomyID."
  9. First observedv0.1.11

TDQS

A4.2/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare readOnly/openWorld/idempotent; the description adds substantial behavior beyond that: per-type pagination capped at maxPerType with total count reported, per-type ordering rules (PubMed highest-first, other numerics ascending, CAS/EC most-attested first, string IDs in PubChem order), and a partial-failure contract naming failedTypes while other types still return. The failure-only-when-no-type-loads rule (with ProteinGI exempt) is exactly the kind of edge-case disclosure an agent needs to interpret a thin response.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded in the first clause, then paging, then ordering, then failure semantics — a sensible order with no filler sentences. It is dense and longer than typical, with some overlap against the already-verbose schema text, but nearly every sentence carries operational information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter, read-only lookup with an output schema, the description covers the things the schema cannot: ordering guarantees, partial-failure behavior, the ProteinGI dead end, and how to page past a cap. Nothing an agent needs to call this correctly and interpret the result appears missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the schema already spells out offset's per-type application, maxPerType's 500 effective cap, and the full xrefTypes enum semantics. The description restates much of this (capping, offset, ordering) rather than adding new parameter meaning, so the baseline 3 is appropriate — it reinforces but does not extend the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ('Get external database cross-references for a compound') and immediately enumerates the concrete payload: PubMed citations, patent IDs, gene associations, CAS/EC numbers, registry numbers, taxonomy IDs. That is enough for an agent to distinguish it from siblings like pubchem_get_compound_details or pubchem_get_bioactivity without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives strong in-tool guidance — it explains the offset paging contract, the maxPerType cap, and explicitly steers away from ProteinGI toward GeneID. It does not, however, say when an agent should call this tool rather than the compound-details, interactions, or summary siblings, so cross-tool routing is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.