compare_activities
Compare bioactivity data across multiple compounds or targets to analyze pharmacological profiles and identify patterns in drug discovery research.
Instructions
Compare bioactivity data across multiple compounds or targets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| molecule_chembl_ids | Yes | Array of ChEMBL compound IDs (2-10) | |
| target_chembl_id | No | ChEMBL target ID for comparison | |
| activity_type | No | Activity type for comparison |
Implementation Reference
- src/index.ts:1216-1272 (handler)The handler function that executes the tool. It validates the input arguments, fetches bioactivity data from ChEMBL API for each provided molecule_chembl_id (filtered by optional target_chembl_id and activity_type), compiles comparison results including activity counts and samples, and returns a formatted JSON response.private async handleCompareActivities(args: any) { if (!args || !Array.isArray(args.molecule_chembl_ids) || args.molecule_chembl_ids.length < 2) { throw new McpError(ErrorCode.InvalidParams, 'Invalid activity comparison arguments'); } try { const comparisonResults = []; for (const chemblId of args.molecule_chembl_ids.slice(0, 10)) { const params: any = { molecule_chembl_id: chemblId, limit: 50, }; if (args.target_chembl_id) { params.target_chembl_id = args.target_chembl_id; } if (args.activity_type) { params.standard_type = args.activity_type; } try { const response = await this.apiClient.get('/activity.json', { params }); const activities = response.data.activities || []; comparisonResults.push({ molecule_chembl_id: chemblId, activity_count: activities.length, activities: activities.slice(0, 20), }); } catch (error) { comparisonResults.push({ molecule_chembl_id: chemblId, error: error instanceof Error ? error.message : 'Unknown error', }); } } return { content: [ { type: 'text', text: JSON.stringify({ comparison_results: comparisonResults, target_filter: args.target_chembl_id, activity_type_filter: args.activity_type, }, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to compare activities: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:574-585 (registration)Registration of the 'compare_activities' tool in the ListTools response, including name, description, and input schema definition.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'], }, },
- src/index.ts:776-777 (registration)Dispatcher case in the CallToolRequestSchema handler that routes calls to the compare_activities handler function.return await this.handleCompareActivities(args); // Drug Development & Clinical Data
- src/index.ts:576-584 (schema)Input schema definition for the compare_activities tool, specifying parameters like molecule_chembl_ids (required array), target_chembl_id, and activity_type.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'], },