Skip to main content
Glama
Augmented-Nature

ChEMBL MCP Server

search_similar_compounds

Find chemically similar compounds to a query molecule using Tanimoto similarity, with configurable thresholds and result limits.

Instructions

Find chemically similar compounds using Tanimoto similarity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
smilesYesSMILES string of the query molecule
similarityNoSimilarity threshold (0-1, default: 0.7)
limitNoNumber of results to return (1-1000, default: 25)

Implementation Reference

  • The main handler function that implements the 'search_similar_compounds' tool logic. It validates input, calls the ChEMBL similarity search API using the provided SMILES and similarity threshold, and returns the results.
    private async handleSearchSimilarCompounds(args: any) {
      if (!isValidSimilaritySearchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid similarity search arguments');
      }
    
      try {
        // ChEMBL similarity search using SMILES
        const similarity = args.similarity !== undefined ? Math.round(args.similarity * 100) : 70;
        const response = await this.apiClient.get('/similarity/' + encodeURIComponent(args.smiles) + '/' + similarity + '.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 search similar compounds: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • The input schema definition for the 'search_similar_compounds' tool, registered in the ListTools handler. Defines parameters: smiles (required), similarity, limit.
      name: 'search_similar_compounds',
      description: 'Find chemically similar compounds using Tanimoto similarity',
      inputSchema: {
        type: 'object',
        properties: {
          smiles: { type: 'string', description: 'SMILES string of the query molecule' },
          similarity: { type: 'number', description: 'Similarity threshold (0-1, default: 0.7)', minimum: 0, maximum: 1 },
          limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
        },
        required: ['smiles'],
      },
    },
  • src/index.ts:753-754 (registration)
    The switch case in the CallToolRequestSchema handler that dispatches calls to the search_similar_compounds tool to its handler function.
    case 'search_similar_compounds':
      return await this.handleSearchSimilarCompounds(args);
  • Type guard and validation function for the input arguments of the search_similar_compounds tool.
    const isValidSimilaritySearchArgs = (
      args: any
    ): args is { smiles: string; similarity?: number; limit?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.smiles === 'string' &&
        args.smiles.length > 0 &&
        (args.similarity === undefined || (typeof args.similarity === 'number' && args.similarity >= 0 && args.similarity <= 1)) &&
        (args.limit === undefined || (typeof args.limit === 'number' && args.limit > 0 && args.limit <= 1000))
      );
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions the similarity metric (Tanimoto) but doesn't disclose performance characteristics, data sources, rate limits, error conditions, or output format. For a search tool with no annotation coverage, this leaves significant gaps in understanding how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core purpose and includes the key technical detail (Tanimoto similarity) that defines the tool's approach.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the search returns (structures, IDs, properties?), how results are ordered, whether there's pagination, or what data sources are used. The agent would need to guess about the tool's behavior and outputs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds no additional parameter information beyond what's in the schema (e.g., doesn't explain SMILES format details or similarity calculation nuances). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Find chemically similar compounds') and method ('using Tanimoto similarity'), distinguishing it from siblings like 'search_compounds' (general search) or 'substructure_search' (structural matching). It precisely communicates the tool's purpose with technical specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search_compounds' or 'substructure_search'. It doesn't mention prerequisites, typical use cases, or limitations, leaving the agent to infer usage from the name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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