search_by_inchi
Find chemicals in the SureChEMBL patent database using InChI strings or InChI keys to identify compounds and their patent information.
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 that executes the tool logic for 'search_by_inchi'. It validates the input 'inchi' parameter and returns a standardized response indicating that direct InChI search is not supported by the SureChEMBL API, providing a helpful message and suggestion.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:422-433 (schema)The input schema definition for the 'search_by_inchi' tool, including properties for 'inchi' (required string) and optional 'limit' (number between 1-1000). This is part of the tools list returned by ListToolsRequest.{ 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 CallToolRequest handler that registers and dispatches 'search_by_inchi' calls to the handleSearchByInchi method.case 'search_by_inchi': return await this.handleSearchByInchi(args);