get_chemical_properties
Retrieve molecular properties and descriptors for chemicals using SureChEMBL IDs to analyze patent-related chemical data.
Instructions
Get molecular properties and descriptors for a chemical by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chemical_id | Yes | SureChEMBL chemical ID |
Implementation Reference
- src/index.ts:845-894 (handler)The handler function that validates input, fetches chemical data from SureChEMBL API using the chemical_id, extracts and formats various molecular properties (e.g., SMILES, molecular weight, InChI, frequency), and returns a JSON response.private async handleGetChemicalProperties(args: any) { if (!args || typeof args.chemical_id !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid chemical ID'); } try { const response = await this.apiClient.get(`/chemical/id/${args.chemical_id}`); // Extract and format properties const chemical = response.data.data?.[0]; if (!chemical) { throw new Error('Chemical not found'); } const properties = { chemical_id: chemical.chemical_id, name: chemical.name, molecular_weight: chemical.mol_weight, smiles: chemical.smiles, inchi: chemical.inchi, inchi_key: chemical.inchi_key, is_element: chemical.is_element === '1', global_frequency: chemical.global_frequency, structural_alerts: chemical.mchem_struct_alert === '1', // Additional computed properties if available log_p: chemical.log_p, donor_count: chemical.donor_count, acceptor_count: chemical.accept_count, ring_count: chemical.ring_count, rotatable_bonds: chemical.rotatable_bond_count }; return { content: [ { type: 'text', text: JSON.stringify({ chemical_id: args.chemical_id, properties: properties }, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to get chemical properties: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:451-457 (schema)Input schema definition specifying that 'chemical_id' (string, SureChEMBL chemical ID) is required.inputSchema: { type: 'object', properties: { chemical_id: { type: 'string', description: 'SureChEMBL chemical ID' }, }, required: ['chemical_id'], },
- src/index.ts:448-458 (registration)Tool registration in the MCP server's tools list, including name, description, and input schema.{ name: 'get_chemical_properties', description: 'Get molecular properties and descriptors for a chemical by ID', inputSchema: { type: 'object', properties: { chemical_id: { type: 'string', description: 'SureChEMBL chemical ID' }, }, required: ['chemical_id'], }, },
- src/index.ts:564-565 (registration)Dispatch case in the MCP request handler switch statement that routes 'get_chemical_properties' calls to the handler method.case 'get_chemical_properties': return await this.handleGetChemicalProperties(args);