search_by_inchi
Identify chemicals in the SureChEMBL patent database using InChI or InChI key queries, with adjustable result limits for precise chemical patent research.
Instructions
Search for chemicals by InChI or InChI key
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inchi | Yes | InChI string or InChI key | |
| limit | No | Number of results to return (1-1000, default: 25) |
Implementation Reference
- src/index.ts:775-800 (handler)The handler function for the 'search_by_inchi' tool. Validates the input arguments, notes that direct InChI search is not supported by the SureChEMBL API, and returns a helpful message with suggestions.private async handleSearchByInchi(args: any) { if (!args || typeof args.inchi !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid InChI string'); } try { // SureChEMBL doesn't have direct InChI search, so we'll return a helpful message return { content: [ { type: 'text', text: JSON.stringify({ message: 'InChI search not directly supported by SureChEMBL API', inchi: args.inchi, suggestion: 'Try converting InChI to chemical name or use chemical ID lookup' }, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to search by InChI: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:423-433 (schema)The tool definition including name, description, and input schema for 'search_by_inchi' registered in the ListToolsRequestSchema handler.name: 'search_by_inchi', description: 'Search for chemicals by InChI or InChI key', inputSchema: { type: 'object', properties: { inchi: { type: 'string', description: 'InChI string or InChI key' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['inchi'], }, },
- src/index.ts:559-560 (registration)The switch case in the CallToolRequestSchema handler that dispatches 'search_by_inchi' calls to the handleSearchByInchi method.case 'search_by_inchi': return await this.handleSearchByInchi(args);