compare_activities
Analyze and compare bioactivity data for specific compounds and targets using the ChEMBL MCP Server. Identify activity patterns for up to 10 compounds against a defined target and activity type.
Instructions
Compare bioactivity data across multiple compounds or targets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activity_type | No | Activity type for comparison | |
| molecule_chembl_ids | Yes | Array of ChEMBL compound IDs (2-10) | |
| target_chembl_id | No | ChEMBL target ID for comparison |
Implementation Reference
- src/index.ts:1216-1272 (handler)The main handler function that executes the compare_activities tool. It fetches bioactivity data from ChEMBL API for multiple compounds (optionally filtered by target and activity type) and compiles a comparison result.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 (schema)The input schema definition for the compare_activities tool, specifying parameters like molecule_chembl_ids (required array of 2-10 ChEMBL IDs), optional target_chembl_id and activity_type.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)The registration/dispatch case in the CallToolRequestSchema handler that routes calls to the compare_activities tool to its handler function.return await this.handleCompareActivities(args); // Drug Development & Clinical Data