Skip to main content
Glama
Augmented-Nature

ChEMBL MCP Server

search_compounds

Find chemical compounds in the ChEMBL database by entering names, synonyms, or identifiers to retrieve relevant results.

Instructions

Search ChEMBL database for compounds by name, synonym, or identifier

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (compound name, synonym, or identifier)
limitNoNumber of results to return (1-1000, default: 25)
offsetNoNumber of results to skip (default: 0)

Implementation Reference

  • The main handler function that validates the input arguments using isValidCompoundSearchArgs and performs an API request to the ChEMBL '/molecule/search.json' endpoint with the query, limit, and offset parameters. Returns the JSON response as text content.
    private async handleSearchCompounds(args: any) {
      if (!isValidCompoundSearchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid compound search arguments');
      }
    
      try {
        const response = await this.apiClient.get('/molecule/search.json', {
          params: {
            q: args.query,
            limit: args.limit || 25,
            offset: args.offset || 0,
          },
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to search compounds: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • The input schema definition for the search_compounds tool, specifying the expected parameters: query (required string), optional limit and offset numbers with constraints.
    inputSchema: {
      type: 'object',
      properties: {
        query: { type: 'string', description: 'Search query (compound name, synonym, or identifier)' },
        limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
        offset: { type: 'number', description: 'Number of results to skip (default: 0)', minimum: 0 },
      },
      required: ['query'],
  • src/index.ts:396-407 (registration)
    Tool registration in the ListToolsRequestSchema response, including name, description, and input schema.
    {
      name: 'search_compounds',
      description: 'Search ChEMBL database for compounds by name, synonym, or identifier',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'Search query (compound name, synonym, or identifier)' },
          limit: { type: 'number', description: 'Number of results to return (1-1000, default: 25)', minimum: 1, maximum: 1000 },
          offset: { type: 'number', description: 'Number of results to skip (default: 0)', minimum: 0 },
        },
        required: ['query'],
      },
  • src/index.ts:745-746 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement, routing calls to the handleSearchCompounds method.
    case 'search_compounds':
      return await this.handleSearchCompounds(args);
  • Type guard and validation function for search_compounds input arguments, ensuring query is a non-empty string and limit/offset are valid numbers.
    const isValidCompoundSearchArgs = (
      args: any
    ): args is { query: string; limit?: number; offset?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.query === 'string' &&
        args.query.length > 0 &&
        (args.limit === undefined || (typeof args.limit === 'number' && args.limit > 0 && args.limit <= 1000)) &&
        (args.offset === undefined || (typeof args.offset === 'number' && args.offset >= 0))
      );
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the search scope but does not cover critical aspects like whether the search is case-sensitive, the format of returned results, error handling, or performance characteristics (e.g., rate limits). This leaves significant gaps for a tool with three parameters.

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 that front-loads the core functionality without unnecessary details. Every word contributes to understanding the tool's purpose, making it appropriately concise and well-structured.

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?

Given the lack of annotations and output schema, the description is insufficient for a search tool with three parameters. It does not explain the return format, result ordering, or potential limitations, leaving the agent with incomplete information to effectively use the tool in context.

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 input schema fully documents the parameters. The description adds minimal value by implying the 'query' parameter accepts multiple input types, but it does not provide additional syntax, examples, or constraints beyond what the schema already specifies.

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

Purpose4/5

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

The description clearly states the verb ('Search') and resource ('ChEMBL database for compounds'), specifying the search scope ('by name, synonym, or identifier'). However, it does not explicitly differentiate from sibling tools like 'search_by_inchi' or 'search_similar_compounds', which may have overlapping purposes but different search methods.

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 such as 'search_by_inchi' or 'search_similar_compounds'. It lacks context about specific use cases, exclusions, or prerequisites, leaving the agent to infer usage based on tool names 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