get_target_compounds
Retrieve compounds tested against a specific target from the ChEMBL database, filtered by activity type or result limit, for streamlined research insights.
Instructions
Get compounds tested against a specific target
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activity_type | No | Activity type filter (e.g., IC50, Ki, Kd) | |
| limit | No | Number of results to return (1-1000, default: 25) | |
| target_chembl_id | Yes | ChEMBL target ID |
Implementation Reference
- src/index.ts:989-1031 (handler)The main handler function `handleGetTargetCompounds` that implements the tool logic. Validates input arguments, queries the ChEMBL `/activity.json` endpoint filtered by `target_chembl_id` (optionally `activity_type`), extracts unique `molecule_chembl_id`s from activities, and returns a formatted JSON summary with counts and truncated lists.// Placeholder implementations for remaining tools private async handleGetTargetCompounds(args: any) { if (!args || typeof args.target_chembl_id !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid target compounds arguments'); } try { const params: any = { target_chembl_id: args.target_chembl_id, limit: args.limit || 25, }; if (args.activity_type) { params.standard_type = args.activity_type; } const response = await this.apiClient.get('/activity.json', { params }); // Extract unique compounds from activities const activities = response.data.activities || []; const compoundIds = [...new Set(activities.map((a: any) => a.molecule_chembl_id))]; return { content: [ { type: 'text', text: JSON.stringify({ target_chembl_id: args.target_chembl_id, total_activities: activities.length, unique_compounds: compoundIds.length, compound_ids: compoundIds.slice(0, 100), activities: activities.slice(0, 50), }, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to get target compounds: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:484-495 (registration)Registration of the `get_target_compounds` tool in the `tools` array returned by `ListToolsRequestSchema` handler. Includes name, description, and input schema definition.name: 'get_target_compounds', description: 'Get compounds tested against a specific target', inputSchema: { type: 'object', properties: { target_chembl_id: { type: 'string', description: 'ChEMBL target ID' }, activity_type: { type: 'string', description: 'Activity type filter (e.g., IC50, Ki, Kd)' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['target_chembl_id'], }, },
- src/index.ts:760-761 (registration)Dispatch/registration in the `CallToolRequestSchema` switch statement that routes calls to `get_target_compounds` to the `handleGetTargetCompounds` handler.case 'get_target_compounds': return await this.handleGetTargetCompounds(args);
- src/index.ts:486-494 (schema)Input schema definition for the `get_target_compounds` tool, specifying required `target_chembl_id` and optional `activity_type` and `limit` parameters with types and constraints.inputSchema: { type: 'object', properties: { target_chembl_id: { type: 'string', description: 'ChEMBL target ID' }, activity_type: { type: 'string', description: 'Activity type filter (e.g., IC50, Ki, Kd)' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['target_chembl_id'], },