Skip to main content
Glama

Get Compound Cross-References

pubchem_get_compound_xrefs
Read-onlyIdempotent

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.

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.
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. Changed8 schema fields changed
    • 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."
  2. Changed5 schema fields changed
    • 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."
  3. Changed2 schema fields changed
    • removedInput schema / properties / cid / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / cid / minimum
      Added value: +1
  4. Changed7 schema fields changed
    • 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"
      -]
  5. Changed1 schema field changed
    • changedInput schema / properties / maxPerType / type
      Previous value: -"number"New value: +"integer"
  6. Changed9 schema fields changed
    • 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."
    • 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 changed
    • 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. Changed4 schema fields changed
    • 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."
    • 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. Changed3 schema fields changed
    • 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."
  10. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, the description discloses rich behavior: per-type paging capped at maxPerType with total count reported, offset semantics, type-specific ordering (PubMed newest-first, CAS/EC most-attested-first), and partial-failure handling via failedTypes. This is exactly the behavioral context an agent needs to invoke and interpret results correctly.

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?

The description is dense and front-loaded with the core purpose before moving into paging, ordering, and failure semantics. It is long but every sentence carries operational information; slight tightening around ordering could improve it, but it remains well-structured.

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?

Given the tool's complexity (9 xref types, paging, partial failures) and the presence of an output schema, the description covers all decision-critical behavior. An agent knows what it returns, how paging works, and how failures are surfaced without needing to inspect the output schema.

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%, so the schema already documents cid, offset, maxPerType, and xrefTypes in detail. The description reinforces paging and failure behavior but adds no new syntax or format details beyond what the schema provides, making the baseline 3 appropriate.

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?

The description opens with a specific verb and resource: 'Get external database cross-references for a compound,' then enumerates the exact types returned (PubMed, patent IDs, gene associations, CAS/EC numbers, registry numbers, taxonomy IDs). This clearly distinguishes the tool from siblings like compound details, bioactivity, safety, or image retrieval.

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

Usage Guidelines4/5

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

The description establishes clear context for when to use the tool by listing the xref categories it retrieves. It does not explicitly name alternative sibling tools or state when not to use it, but the scope is sufficiently concrete that an agent can infer it is the right call for cross-reference data.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.