Skip to main content
Glama
Augmented-Nature

ChEMBL MCP Server

get_compound_structure

Retrieve chemical structure information in SMILES, InChI, MOLfile, or SDF format using a ChEMBL compound ID.

Instructions

Retrieve chemical structure information in various formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chembl_idYesChEMBL compound ID
formatNoStructure format (default: smiles)

Implementation Reference

  • The main handler function that implements the tool logic. Fetches compound data from the ChEMBL API using the provided ChEMBL ID and returns the structure information (SMILES, InChI, etc.) in a standardized JSON response.
    private async handleGetCompoundStructure(args: any) {
      if (!args || typeof args.chembl_id !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments');
      }
    
      try {
        const response = await this.apiClient.get(`/molecule/${args.chembl_id}.json`);
        const compound = response.data;
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                chembl_id: compound.molecule_chembl_id,
                structures: compound.molecule_structures || {},
                requested_format: args.format || 'smiles'
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(ErrorCode.InternalError, `Failed to get structure: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • The input schema definition for the get_compound_structure tool, specifying the required chembl_id parameter and optional format.
      name: 'get_compound_structure',
      description: 'Retrieve chemical structure information in various formats',
      inputSchema: {
        type: 'object',
        properties: {
          chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
          format: { type: 'string', enum: ['smiles', 'inchi', 'molfile', 'sdf'], description: 'Structure format (default: smiles)' },
        },
        required: ['chembl_id'],
      },
    },
  • src/index.ts:751-753 (registration)
    The dispatch case in the CallToolRequestSchema handler that routes tool calls named 'get_compound_structure' to its handler function.
    case 'get_compound_structure':
      return await this.handleGetCompoundStructure(args);
    case 'search_similar_compounds':
  • src/index.ts:394-736 (registration)
    The tool is registered in the ListToolsRequestSchema response, making it discoverable by MCP clients.
    tools: [
      // Core Chemical Search & Retrieval (5 tools)
      {
        name: 'search_compounds',
        description: 'Search ChEMBL database for compounds by name, synonym, or identifier',
        inputSchema: {
          type: 'object',
          properties: {
            query: { type: 'string', description: 'Search query (compound name, synonym, or identifier)' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
            offset: { type: 'number', description: 'Number of results to skip (default: 0)', minimum: 0 },
          },
          required: ['query'],
        },
      },
      {
        name: 'get_compound_info',
        description: 'Get detailed information for a specific compound by ChEMBL ID',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL compound ID (e.g., CHEMBL59)' },
          },
          required: ['chembl_id'],
        },
      },
      {
        name: 'search_by_inchi',
        description: 'Search for compounds by InChI key or InChI string',
        inputSchema: {
          type: 'object',
          properties: {
            inchi: { type: 'string', description: 'InChI key or InChI string' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['inchi'],
        },
      },
      {
        name: 'get_compound_structure',
        description: 'Retrieve chemical structure information in various formats',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
            format: { type: 'string', enum: ['smiles', 'inchi', 'molfile', 'sdf'], description: 'Structure format (default: smiles)' },
          },
          required: ['chembl_id'],
        },
      },
      {
        name: 'search_similar_compounds',
        description: 'Find chemically similar compounds using Tanimoto similarity',
        inputSchema: {
          type: 'object',
          properties: {
            smiles: { type: 'string', description: 'SMILES string of the query molecule' },
            similarity: { type: 'number', description: 'Similarity threshold (0-1, default: 0.7)', minimum: 0, maximum: 1 },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['smiles'],
        },
      },
      // Target Analysis & Drug Discovery (5 tools)
      {
        name: 'search_targets',
        description: 'Search for biological targets by name or type',
        inputSchema: {
          type: 'object',
          properties: {
            query: { type: 'string', description: 'Target name or search query' },
            target_type: { type: 'string', description: 'Target type filter (e.g., SINGLE PROTEIN, PROTEIN COMPLEX)' },
            organism: { type: 'string', description: 'Organism filter' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['query'],
        },
      },
      {
        name: 'get_target_info',
        description: 'Get detailed information for a specific target by ChEMBL target ID',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL target ID (e.g., CHEMBL2095173)' },
          },
          required: ['chembl_id'],
        },
      },
      {
        name: 'get_target_compounds',
        description: 'Get compounds tested against a specific target',
        inputSchema: {
          type: 'object',
          properties: {
            target_chembl_id: { type: 'string', description: 'ChEMBL target ID' },
            activity_type: { type: 'string', description: 'Activity type filter (e.g., IC50, Ki, Kd)' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['target_chembl_id'],
        },
      },
      {
        name: 'search_by_uniprot',
        description: 'Find ChEMBL targets by UniProt accession',
        inputSchema: {
          type: 'object',
          properties: {
            uniprot_id: { type: 'string', description: 'UniProt accession number' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['uniprot_id'],
        },
      },
      {
        name: 'get_target_pathways',
        description: 'Get biological pathways associated with a target',
        inputSchema: {
          type: 'object',
          properties: {
            target_chembl_id: { type: 'string', description: 'ChEMBL target ID' },
          },
          required: ['target_chembl_id'],
        },
      },
      // Bioactivity & Assay Data (5 tools)
      {
        name: 'search_activities',
        description: 'Search bioactivity measurements and assay results',
        inputSchema: {
          type: 'object',
          properties: {
            target_chembl_id: { type: 'string', description: 'ChEMBL target ID filter' },
            assay_chembl_id: { type: 'string', description: 'ChEMBL assay ID filter' },
            molecule_chembl_id: { type: 'string', description: 'ChEMBL compound ID filter' },
            activity_type: { type: 'string', description: 'Activity type (e.g., IC50, Ki, EC50)' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: [],
        },
      },
      {
        name: 'get_assay_info',
        description: 'Get detailed information for a specific assay by ChEMBL assay ID',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL assay ID (e.g., CHEMBL1217643)' },
          },
          required: ['chembl_id'],
        },
      },
      {
        name: 'search_by_activity_type',
        description: 'Find bioactivity data by specific activity type and value range',
        inputSchema: {
          type: 'object',
          properties: {
            activity_type: { type: 'string', description: 'Activity type (e.g., IC50, Ki, EC50, Kd)' },
            min_value: { type: 'number', description: 'Minimum activity value' },
            max_value: { type: 'number', description: 'Maximum activity value' },
            units: { type: 'string', description: 'Units filter (e.g., nM, uM)' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['activity_type'],
        },
      },
      {
        name: 'get_dose_response',
        description: 'Get dose-response data and activity profiles for compounds',
        inputSchema: {
          type: 'object',
          properties: {
            molecule_chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
            target_chembl_id: { type: 'string', description: 'ChEMBL target ID (optional filter)' },
          },
          required: ['molecule_chembl_id'],
        },
      },
      {
        name: 'compare_activities',
        description: 'Compare bioactivity data across multiple compounds or targets',
        inputSchema: {
          type: 'object',
          properties: {
            molecule_chembl_ids: { type: 'array', items: { type: 'string' }, description: 'Array of ChEMBL compound IDs (2-10)', minItems: 2, maxItems: 10 },
            target_chembl_id: { type: 'string', description: 'ChEMBL target ID for comparison' },
            activity_type: { type: 'string', description: 'Activity type for comparison' },
          },
          required: ['molecule_chembl_ids'],
        },
      },
      // Drug Development & Clinical Data (4 tools)
      {
        name: 'search_drugs',
        description: 'Search for approved drugs and clinical candidates',
        inputSchema: {
          type: 'object',
          properties: {
            query: { type: 'string', description: 'Drug name or search query' },
            development_phase: { type: 'string', description: 'Development phase filter (e.g., Approved, Phase III)' },
            therapeutic_area: { type: 'string', description: 'Therapeutic area filter' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['query'],
        },
      },
      {
        name: 'get_drug_info',
        description: 'Get drug development status and clinical trial information',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
          },
          required: ['chembl_id'],
        },
      },
      {
        name: 'search_drug_indications',
        description: 'Search for therapeutic indications and disease areas',
        inputSchema: {
          type: 'object',
          properties: {
            indication: { type: 'string', description: 'Disease or indication search term' },
            drug_type: { type: 'string', description: 'Drug type filter (e.g., Small molecule, Antibody)' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['indication'],
        },
      },
      {
        name: 'get_mechanism_of_action',
        description: 'Get mechanism of action and target interaction data',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
          },
          required: ['chembl_id'],
        },
      },
      // Chemical Property Analysis (4 tools)
      {
        name: 'analyze_admet_properties',
        description: 'Analyze ADMET properties (Absorption, Distribution, Metabolism, Excretion, Toxicity)',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
          },
          required: ['chembl_id'],
        },
      },
      {
        name: 'calculate_descriptors',
        description: 'Calculate molecular descriptors and physicochemical properties',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
            smiles: { type: 'string', description: 'SMILES string (alternative to ChEMBL ID)' },
          },
          required: [],
        },
      },
      {
        name: 'predict_solubility',
        description: 'Predict aqueous solubility and permeability properties',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
            smiles: { type: 'string', description: 'SMILES string (alternative to ChEMBL ID)' },
          },
          required: [],
        },
      },
      {
        name: 'assess_drug_likeness',
        description: 'Assess drug-likeness using Lipinski Rule of Five and other metrics',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_id: { type: 'string', description: 'ChEMBL compound ID' },
            smiles: { type: 'string', description: 'SMILES string (alternative to ChEMBL ID)' },
          },
          required: [],
        },
      },
      // Advanced Search & Cross-References (4 tools)
      {
        name: 'substructure_search',
        description: 'Find compounds containing specific substructures',
        inputSchema: {
          type: 'object',
          properties: {
            smiles: { type: 'string', description: 'SMILES string of the substructure query' },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: ['smiles'],
        },
      },
      {
        name: 'batch_compound_lookup',
        description: 'Process multiple ChEMBL IDs efficiently',
        inputSchema: {
          type: 'object',
          properties: {
            chembl_ids: { type: 'array', items: { type: 'string' }, description: 'Array of ChEMBL compound IDs (1-50)', minItems: 1, maxItems: 50 },
          },
          required: ['chembl_ids'],
        },
      },
      {
        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'],
        },
      },
      {
        name: 'advanced_search',
        description: 'Complex queries with multiple chemical and biological filters',
        inputSchema: {
          type: 'object',
          properties: {
            min_mw: { type: 'number', description: 'Minimum molecular weight (Da)', minimum: 0 },
            max_mw: { type: 'number', description: 'Maximum molecular weight (Da)', minimum: 0 },
            min_logp: { type: 'number', description: 'Minimum LogP value' },
            max_logp: { type: 'number', description: 'Maximum LogP value' },
            max_hbd: { type: 'number', description: 'Maximum hydrogen bond donors', minimum: 0 },
            max_hba: { type: 'number', description: 'Maximum hydrogen bond acceptors', minimum: 0 },
            limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          },
          required: [],
        },
      },
    ],
  • Type guard function used for validating the chembl_id argument in the handler and other similar tools.
    const isValidChemblIdArgs = (
      args: any
    ): args is { chembl_id: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.chembl_id === 'string' &&
        args.chembl_id.length > 0
      );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a retrieval operation but doesn't mention whether it requires authentication, has rate limits, returns partial data on errors, or provides any metadata alongside the structure. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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 that gets straight to the point. Every word earns its place: 'retrieve' (action), 'chemical structure information' (resource), 'various formats' (key capability). There's no fluff or redundant information.

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?

For a read-only tool with 2 parameters and 100% schema coverage, the description is minimally adequate. However, with no output schema and no annotations, it should ideally explain what the return value contains (e.g., just the structure string or additional metadata). The description mentions 'information' which is vague about the return format.

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 fully documents both parameters (chembl_id and format with enum values). The description adds minimal value beyond what's in the schema - it mentions 'various formats' which aligns with the format parameter but doesn't provide additional context about format differences or use cases. Baseline 3 is appropriate when schema does the heavy lifting.

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 action ('retrieve') and resource ('chemical structure information'), specifying the type of data returned. It distinguishes from siblings like 'get_compound_info' by focusing specifically on structure formats rather than general compound metadata. However, it doesn't explicitly contrast with format-specific siblings like 'search_by_inchi'.

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 doesn't mention when to choose this over 'get_compound_info' (which might include structure data) or format-specific search tools like 'search_by_inchi'. There's no context about prerequisites, limitations, or appropriate use cases.

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