# `pubchem__pubchem_get_compound_xrefs`

**Get Compound Cross-References**

Get external database cross-references for a compound: PubMed citations, patent IDs, gene/protein associations, 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.

- Server: [PubChem](https://gateway.mcpharbor.dev/docs/servers/pubchem) (`dev.mcpharbor.gateway/pubchem`)
- Price per call: $0.0001 (100 micro-USD); only tools/call is charged
- Endpoint: `https://gateway.mcpharbor.dev/mcp` or `https://gateway.mcpharbor.dev/mcp/pubchem`
- Upstream tool: exposed by the provider; called through this gateway as `pubchem__pubchem_get_compound_xrefs`
- Provider terms: <https://www.ncbi.nlm.nih.gov/home/about/policies/> (verified 2026-09-19)
- Upstream API documentation: <https://pubchem.ncbi.nlm.nih.gov/docs/pug-rest>
- Rate limit: 350 requests per minute
- Attribution required: Attribution to source recommended, not mandatory

## Parameters

- `cid` (integer, required): PubChem Compound ID. Resolve from name/SMILES with pubchem_search_compounds.
- `maxPerType` (integer, optional): 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. Default: `50`.
- `offset` (integer, optional): 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. Default: `0`.
- `xrefTypes` (array, required): 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), T...

## Example call

Request headers and body:

```http
POST /mcp HTTP/1.1
Host: gateway.mcpharbor.dev
Authorization: Bearer <your gateway API key>
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: pubchem__pubchem_get_compound_xrefs
```

```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "_meta": {
      "io.modelcontextprotocol/clientCapabilities": {},
      "io.modelcontextprotocol/clientInfo": {
        "name": "example-agent",
        "version": "1.0.0"
      },
      "io.modelcontextprotocol/protocolVersion": "2026-07-28"
    },
    "arguments": {
      "cid": 1,
      "xrefTypes": []
    },
    "name": "pubchem__pubchem_get_compound_xrefs"
  }
}
```

A successful response:

```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "_meta": {
      "dev.mcpharbor.gateway/call": {
        "chargedMicroUsd": 100,
        "id": "<the id of this charge>"
      }
    },
    "content": [
      {
        "text": "<whatever the upstream tool returned>",
        "type": "text"
      }
    ],
    "resultType": "complete"
  }
}
```

This call costs $0.0001 (100 micro-USD). Reading this page and listing the tool cost nothing.
The `dev.mcpharbor.gateway/call` record in the result is the receipt for that charge. Each
POST is metered separately, so sending the same call again buys another one: see
[agent.txt](https://gateway.mcpharbor.dev/agent.txt), section 7, before retrying.

## Attribution

This provider requires the attribution below wherever you use results from its tools.
Reproduce it verbatim:

> Attribution to source recommended, not mandatory

## Tool definition

Exactly as `tools/list` returns it (free):

```json
{
  "_meta": {
    "dev.mcpharbor.gateway/pricing": {
      "currency": "USD",
      "pricePerCallMicroUsd": 100
    }
  },
  "annotations": {
    "idempotentHint": true,
    "openWorldHint": true,
    "readOnlyHint": true
  },
  "description": "Get external database cross-references for a compound: PubMed citations, patent IDs, gene/protein associations, 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.",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "cid": {
        "description": "PubChem Compound ID. Resolve from name/SMILES with pubchem_search_compounds.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "maxPerType": {
        "default": 50,
        "description": "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.",
        "maximum": 500,
        "minimum": 1,
        "type": "integer"
      },
      "offset": {
        "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"
      },
      "xrefTypes": {
        "description": "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.",
        "items": {
          "enum": [
            "RegistryID",
            "RN",
            "PubMedID",
            "PatentID",
            "GeneID",
            "ProteinGI",
            "TaxonomyID"
          ],
          "type": "string"
        },
        "minItems": 1,
        "type": "array"
      }
    },
    "required": [
      "cid",
      "xrefTypes"
    ],
    "type": "object"
  },
  "name": "pubchem__pubchem_get_compound_xrefs",
  "outputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "anyOf": [
      {
        "not": {
          "required": [
            "error"
          ]
        },
        "required": [
          "cid",
          "xrefs",
          "offset",
          "truncated"
        ]
      },
      {
        "required": [
          "error"
        ]
      }
    ],
    "properties": {
      "cid": {
        "description": "PubChem Compound ID.",
        "type": "number"
      },
      "error": {
        "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"
      },
      "nextOffset": {
        "description": "Offset to pass on the next call to continue past this page. Omitted when no requested type has further IDs.",
        "type": "number"
      },
      "notice": {
        "description": "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.",
        "type": "string"
      },
      "offset": {
        "description": "Zero-based index of the first ID returned within each type.",
        "type": "number"
      },
      "truncated": {
        "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"
      },
      "xrefs": {
        "description": "Cross-references grouped by type.",
        "items": {
          "additionalProperties": false,
          "description": "Cross-reference group for one type.",
          "properties": {
            "ids": {
              "description": "Cross-reference IDs on this page (window of offset + maxPerType).",
              "items": {
                "anyOf": [
                  {
                    "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"
                  }
                ],
                "description": "Cross-reference identifier — string or number depending on type."
              },
              "type": "array"
            },
            "totalAvailable": {
              "description": "Total IDs available for this type, across all pages.",
              "type": "number"
            },
            "truncated": {
              "description": "True when IDs for this type remain past the current page.",
              "type": "boolean"
            },
            "type": {
              "description": "Cross-reference type: RegistryID, RN, PubMedID, PatentID, GeneID, ProteinGI, or TaxonomyID.",
              "type": "string"
            }
          },
          "required": [
            "type",
            "ids",
            "totalAvailable",
            "truncated"
          ],
          "type": "object"
        },
        "type": "array"
      }
    },
    "type": "object"
  },
  "title": "Get Compound Cross-References"
}
```
