Skip to main content
Glama

batch_compound_lookup

Retrieve detailed compound data for multiple ChEMBL IDs in a single query, supporting up to 50 IDs per request on the ChEMBL MCP Server.

Instructions

Process multiple ChEMBL IDs efficiently

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chembl_idsYesArray of ChEMBL compound IDs (1-50)

Implementation Reference

  • The handler function for batch_compound_lookup that validates input, fetches compound data for up to 10 ChEMBL IDs via parallel API calls, collects results with per-ID error handling, and returns JSON-formatted batch results.
    private async handleBatchCompoundLookup(args: any) { if (!isValidBatchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid batch arguments'); } try { const results = []; for (const chemblId of args.chembl_ids.slice(0, 10)) { // Limit to 10 for demo try { const response = await this.apiClient.get(`/molecule/${chemblId}.json`); results.push({ chembl_id: chemblId, data: response.data, success: true }); } catch (error) { results.push({ chembl_id: chemblId, error: error instanceof Error ? error.message : 'Unknown error', success: false }); } } return { content: [{ type: 'text', text: JSON.stringify({ batch_results: results }, null, 2) }] }; } catch (error) { throw new McpError(ErrorCode.InternalError, `Batch lookup failed: ${error instanceof Error ? error.message : 'Unknown error'}`); } }
  • src/index.ts:697-707 (registration)
    Tool registration in the ListTools response, defining the name, description, and input schema for batch_compound_lookup.
    { name: 'batch_compound_lookup', description: 'Process multiple ChEMBL IDs efficiently', inputSchema: { type: 'object', properties: { chembl_ids: { type: 'array', items: { type: 'string' }, description: 'Array of ChEMBL compound IDs (1-50)', minItems: 1, maxItems: 50 }, }, required: ['chembl_ids'], }, },
  • src/index.ts:798-799 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement that routes calls to the handler.
    case 'batch_compound_lookup': return await this.handleBatchCompoundLookup(args);
  • Type guard function for validating batch_compound_lookup input arguments (array of 1-50 non-empty ChEMBL ID strings).
    const isValidBatchArgs = ( args: any ): args is { chembl_ids: string[] } => { return ( typeof args === 'object' && args !== null && Array.isArray(args.chembl_ids) && args.chembl_ids.length > 0 && args.chembl_ids.length <= 50 && args.chembl_ids.every((id: any) => typeof id === 'string' && id.length > 0) ); };

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