get_mechanism_of_action
Retrieve detailed mechanism of action and target interaction data for a specific compound using its ChEMBL ID. Essential for understanding compound-target relationships in drug discovery.
Instructions
Get mechanism of action and target interaction data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chembl_id | Yes | ChEMBL compound ID |
Implementation Reference
- src/index.ts:784-785 (registration)Registration of the 'get_mechanism_of_action' tool in the CallToolRequestSchema switch statement, dispatching to the handler method.case 'get_mechanism_of_action': return await this.handleGetMechanismOfAction(args);
- src/index.ts:625-634 (schema)Tool definition including name, description, and input schema for 'get_mechanism_of_action' in the ListToolsRequestSchema response.{ 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'], },
- src/index.ts:1383-1410 (handler)The handler function that implements the core logic of the 'get_mechanism_of_action' tool. It validates input, queries the ChEMBL /mechanism.json API endpoint with the compound's ChEMBL ID, and returns the mechanism of action data as JSON.private async handleGetMechanismOfAction(args: any) { if (!isValidChemblIdArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid mechanism of action arguments'); } try { const response = await this.apiClient.get('/mechanism.json', { params: { molecule_chembl_id: args.chembl_id, limit: 50, }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to get mechanism of action: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:90-98 (helper)Helper validation function used by the handler to validate the input arguments for ChEMBL ID.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 );