Skip to main content
Glama

substructure_search

Identify compounds with specific substructures by entering a SMILES string query. Set a limit to retrieve up to 1,000 results using ChEMBL MCP Server.

Instructions

Find compounds containing specific substructures

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of results to return (1-1000, default: 25)
smilesYesSMILES string of the substructure query

Implementation Reference

  • The main handler function for the 'substructure_search' tool. It validates input, calls the ChEMBL substructure search API with the provided SMILES, and returns the JSON results.
    private async handleSubstructureSearch(args: any) { if (!isValidSubstructureSearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid substructure search arguments'); } try { // ChEMBL substructure search using SMILES const response = await this.apiClient.get('/substructure/' + encodeURIComponent(args.smiles) + '.json', { params: { limit: args.limit || 25, }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to perform substructure search: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
  • The tool definition including name, description, and input schema for 'substructure_search' in the ListTools response.
    name: 'substructure_search', description: 'Find compounds containing specific substructures', inputSchema: { type: 'object', properties: { smiles: { type: 'string', description: 'SMILES string of the substructure query' }, limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 }, }, required: ['smiles'], },
  • src/index.ts:796-797 (registration)
    Registration/dispatch of the 'substructure_search' tool handler in the CallToolRequestSchema switch statement.
    case 'substructure_search': return await this.handleSubstructureSearch(args);
  • Type guard function for validating input arguments to the substructure_search tool.
    const isValidSubstructureSearchArgs = ( args: any ): args is { smiles: string; limit?: number } => { return ( typeof args === 'object' && args !== null && typeof args.smiles === 'string' && args.smiles.length > 0 && (args.limit === undefined || (typeof args.limit === 'number' && args.limit > 0 && args.limit <= 1000)) ); };

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