get_chemical_properties
Retrieve molecular properties and descriptors for a chemical using its SureChEMBL ID to analyze and evaluate its characteristics in chemical patent research.
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 primary handler function that implements the get_chemical_properties tool. It validates the input chemical_id, fetches data from the SureChEMBL API, extracts and formats molecular properties (e.g., SMILES, InChI, molecular weight, frequency), and returns a structured 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 for the get_chemical_properties tool, specifying that it requires a 'chemical_id' string parameter.inputSchema: { type: 'object', properties: { chemical_id: { type: 'string', description: 'SureChEMBL chemical ID' }, }, required: ['chemical_id'], },
- src/index.ts:448-458 (registration)Tool registration entry in the ListToolsRequestSchema handler, defining the tool's 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)Dispatcher case in the CallToolRequestSchema handler that routes calls to the get_chemical_properties tool to its handler function.case 'get_chemical_properties': return await this.handleGetChemicalProperties(args);