search_by_uniprot
Identify ChEMBL targets by entering a UniProt accession number. Specify results limit (1-1000) to retrieve relevant data efficiently.
Instructions
Find ChEMBL targets by UniProt accession
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of results to return (1-1000, default: 25) | |
| uniprot_id | Yes | UniProt accession number |
Implementation Reference
- src/index.ts:1033-1059 (handler)The main execution handler for the 'search_by_uniprot' tool. It validates the input arguments, queries the ChEMBL target search API using the provided UniProt ID as the search query, and returns the formatted JSON response or throws an appropriate error.private async handleSearchByUniprot(args: any) { if (!args || typeof args.uniprot_id !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid UniProt arguments'); } try { const response = await this.apiClient.get('/target/search.json', { params: { q: args.uniprot_id, limit: args.limit || 25, }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to search by UniProt: ${error instanceof Error ? error.message : 'Unknown error'}` ); }
- src/index.ts:499-506 (schema)JSON Schema defining the input parameters for the 'search_by_uniprot' tool: required 'uniprot_id' (string) and optional 'limit' (number between 1-1000).inputSchema: { type: 'object', properties: { uniprot_id: { type: 'string', description: 'UniProt accession number' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['uniprot_id'], },
- src/index.ts:497-507 (registration)Registration of the 'search_by_uniprot' tool in the 'tools' array returned by the ListToolsRequestSchema handler, including name, description, and input schema.name: 'search_by_uniprot', description: 'Find ChEMBL targets by UniProt accession', inputSchema: { type: 'object', properties: { uniprot_id: { type: 'string', description: 'UniProt accession number' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['uniprot_id'], }, },
- src/index.ts:762-763 (registration)Dispatch registration in the switch statement of the CallToolRequestSchema handler, routing calls to the 'search_by_uniprot' tool to its handler function.case 'search_by_uniprot': return await this.handleSearchByUniprot(args);