search_chemicals_by_name
Find chemical compounds in the SureChEMBL patent database using names, synonyms, or common terms to identify relevant patent information.
Instructions
Search for chemicals by name, synonym, or common name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Chemical name or synonym to search for | |
| limit | No | Number of results to return (1-1000, default: 25) |
Implementation Reference
- src/index.ts:702-723 (handler)The handler function that validates the input, calls the SureChEMBL API /chemical/name/{name} endpoint, and returns the search results as JSON.private async handleSearchChemicalsByName(args: any) { if (!args || typeof args.name !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid chemical name'); } try { const response = await this.apiClient.get(`/chemical/name/${encodeURIComponent(args.name)}`); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to search chemicals: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:388-398 (registration)Tool registration in the MCP server's listTools response, defining the tool name, description, and input schema.name: 'search_chemicals_by_name', description: 'Search for chemicals by name, synonym, or common name', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Chemical name or synonym to search for' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['name'], }, },
- src/index.ts:391-397 (schema)JSON schema for tool inputs: requires 'name' string, optional 'limit' number (1-1000). Note: handler does not use 'limit'.type: 'object', properties: { name: { type: 'string', description: 'Chemical name or synonym to search for' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['name'], },
- src/index.ts:553-554 (helper)Switch case in CallToolRequestSchema handler that dispatches to the tool's handler function.case 'search_chemicals_by_name': return await this.handleSearchChemicalsByName(args);