Skip to main content
Glama
Augmented-Nature

ChEMBL MCP Server

get_external_references

Retrieve external database links for ChEMBL compounds or targets, connecting to PubChem, DrugBank, PDB, and other resources.

Instructions

Get links to external databases (PubChem, DrugBank, PDB, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chembl_idYesChEMBL compound or target ID

Implementation Reference

  • The handler function that executes the tool logic: validates input, fetches ChEMBL entity data (molecule or target), extracts cross_references, groups them by database source, generates URLs using helper, and returns formatted JSON.
    private async handleGetExternalReferences(args: any) {
      if (!isValidChemblIdArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid external references arguments');
      }
    
      try {
        // Try to get molecule data first
        let response;
        let entityType = 'molecule';
    
        try {
          response = await this.apiClient.get(`/molecule/${args.chembl_id}.json`);
        } catch (e) {
          // If not a molecule, try target
          try {
            response = await this.apiClient.get(`/target/${args.chembl_id}.json`);
            entityType = 'target';
          } catch (e2) {
            throw new McpError(ErrorCode.InvalidParams, 'ChEMBL ID not found as molecule or target');
          }
        }
    
        const entity = response.data;
        const crossRefs = entity.cross_references || [];
    
        // Organize external references by database
        const externalReferences = {
          chembl_id: args.chembl_id,
          entity_type: entityType,
          databases: {} as any,
        };
    
        // Group references by source
        crossRefs.forEach((ref: any) => {
          const source = ref.xref_src || ref.xref_name;
          if (!externalReferences.databases[source]) {
            externalReferences.databases[source] = [];
          }
          externalReferences.databases[source].push({
            id: ref.xref_id,
            name: ref.xref_name,
            url: this.getExternalUrl(source, ref.xref_id),
          });
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(externalReferences, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get external references: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
  • Input schema definition for the tool, specifying required chembl_id parameter.
    inputSchema: {
      type: 'object',
      properties: {
        chembl_id: { type: 'string', description: 'ChEMBL compound or target ID' },
      },
      required: ['chembl_id'],
    },
  • src/index.ts:708-718 (registration)
    Tool registration in the listTools response, defining name, description, and input schema.
    {
      name: 'get_external_references',
      description: 'Get links to external databases (PubChem, DrugBank, PDB, etc.)',
      inputSchema: {
        type: 'object',
        properties: {
          chembl_id: { type: 'string', description: 'ChEMBL compound or target ID' },
        },
        required: ['chembl_id'],
      },
    },
  • src/index.ts:800-801 (registration)
    Dispatch registration in the CallToolRequestSchema handler switch statement.
    case 'get_external_references':
      return await this.handleGetExternalReferences(args);
  • Helper utility to map external database sources to their corresponding URLs.
    private getExternalUrl(source: string, id: string): string {
      const urlMap: { [key: string]: string } = {
        'PubChem': `https://pubchem.ncbi.nlm.nih.gov/compound/${id}`,
        'DrugBank': `https://www.drugbank.ca/drugs/${id}`,
        'PDB': `https://www.rcsb.org/structure/${id}`,
        'UniProt': `https://www.uniprot.org/uniprot/${id}`,
        'Wikipedia': `https://en.wikipedia.org/wiki/${id}`,
        'KEGG': `https://www.genome.jp/entry/${id}`,
        'Reactome': `https://reactome.org/content/detail/${id}`,
      };
      return urlMap[source] || `https://www.ebi.ac.uk/chembl/`;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get links', implying a read-only operation, but does not disclose any behavioral traits such as rate limits, authentication needs, error handling, or what the output format might be (e.g., list of URLs, structured data). This leaves significant gaps in understanding how the tool behaves beyond its basic purpose.

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

Conciseness5/5

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

The description is a single, efficient sentence: 'Get links to external databases (PubChem, DrugBank, PDB, etc.)'. It is front-loaded with the core purpose and includes helpful examples without unnecessary details. Every word earns its place, making it highly concise and well-structured.

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

Completeness3/5

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

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks details on behavioral aspects, usage context, and output. Without annotations or an output schema, the description should do more to compensate, but it only covers the basic purpose, leaving gaps in completeness.

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?

The input schema has 100% description coverage, with the parameter 'chembl_id' fully documented as 'ChEMBL compound or target ID'. The description does not add any additional meaning beyond this, as it does not explain parameter usage, constraints, or examples. With high schema coverage, the baseline score of 3 is appropriate, as the description does not compensate but also does not detract.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get links to external databases (PubChem, DrugBank, PDB, etc.)'. It specifies the verb 'Get' and the resource 'links to external databases', with examples provided. However, it does not explicitly differentiate from sibling tools like 'get_compound_info' or 'get_target_info', which might also provide external references, so it lacks sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, such as needing a ChEMBL ID, or compare it to sibling tools like 'get_compound_info' that might offer similar functionality. There is no explicit when-to-use or when-not-to-use context provided.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Augmented-Nature/ChEMBL-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server