calculate_descriptors
Generate molecular descriptors and physicochemical properties for compounds using ChEMBL IDs or SMILES strings with the ChEMBL MCP Server.
Instructions
Calculate molecular descriptors and physicochemical properties
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chembl_id | No | ChEMBL compound ID | |
| smiles | No | SMILES string (alternative to ChEMBL ID) |
Implementation Reference
- src/index.ts:1502-1582 (handler)Handler function that fetches ChEMBL compound data and extracts molecular descriptors including MW, LogP, HBD/HBA, PSA, rotatable bonds, drug-likeness metrics, and structures.private async handleCalculateDescriptors(args: any) { if (!args || (!args.chembl_id && !args.smiles)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid descriptor calculation arguments'); } try { let molecule; if (args.chembl_id) { const response = await this.apiClient.get(`/molecule/${args.chembl_id}.json`); molecule = response.data; } else { // For SMILES input, we can only provide limited info return { content: [ { type: 'text', text: JSON.stringify({ message: 'SMILES-based descriptor calculation requires ChEMBL ID', smiles: args.smiles, }, null, 2), }, ], }; } const props = molecule.molecule_properties || {}; const structures = molecule.molecule_structures || {}; const descriptors = { chembl_id: molecule.molecule_chembl_id, basic_properties: { molecular_weight: props.full_mwt || props.molecular_weight, exact_mass: props.full_mwt, molecular_formula: props.molecular_formula, }, lipophilicity: { alogp: props.alogp, logp: props.alogp, }, hydrogen_bonding: { hbd: props.hbd, hba: props.hba, }, polar_surface_area: { psa: props.psa, tpsa: props.psa, }, complexity: { rotatable_bonds: props.rtb, aromatic_rings: props.aromatic_rings, heavy_atoms: props.heavy_atoms, num_atoms: props.num_atoms, }, drug_likeness_metrics: { ro5_violations: props.num_ro5_violations, ro3_pass: props.ro3_pass, cx_logp: props.cx_logp, cx_logd: props.cx_logd, }, structures: { smiles: structures.canonical_smiles, inchi: structures.standard_inchi, inchi_key: structures.standard_inchi_key, }, }; return { content: [ { type: 'text', text: JSON.stringify(descriptors, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to calculate descriptors: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:649-659 (schema)Input schema definition for the calculate_descriptors tool in the tools list.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: [], }, },
- src/index.ts:790-791 (registration)Registration/dispatch of the calculate_descriptors handler in the CallToolRequestSchema switch statement.return await this.handleCalculateDescriptors(args); case 'predict_solubility':