Skip to main content
Glama
Augmented-Nature

ChEMBL MCP Server

get_target_compounds

Retrieve compounds tested against a specific biological target from ChEMBL database, filtering by activity type and limiting results.

Instructions

Get compounds tested against a specific target

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_chembl_idYesChEMBL target ID
activity_typeNoActivity type filter (e.g., IC50, Ki, Kd)
limitNoNumber of results to return (1-1000, default: 25)

Implementation Reference

  • Implements the core logic for the 'get_target_compounds' tool. Queries the ChEMBL API /activity endpoint with target_chembl_id filter, processes activities to extract unique molecule_chembl_ids, and returns a summary with compound counts and samples.
    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)
    Registers the 'get_target_compounds' tool in the ListToolsRequestSchema response, defining its name, description, and input schema.
      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)
    Dispatches calls to the 'get_target_compounds' tool to its handler function in the CallToolRequestSchema switch statement.
    case 'get_target_compounds':
      return await this.handleGetTargetCompounds(args);
  • Defines the input schema (JSON Schema) for validating parameters to the 'get_target_compounds' tool: requires target_chembl_id, optional activity_type and limit.
    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'],
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Augmented-Nature/ChEMBL-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server