Skip to main content
Glama
Augmented-Nature

SureChEMBL MCP Server

get_chemical_frequency

Retrieve patent frequency statistics for a chemical using its SureChEMBL ID to analyze its prevalence in patent documents.

Instructions

Get frequency statistics for chemicals across the patent database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chemical_idYesSureChEMBL chemical ID

Implementation Reference

  • The main handler function that implements the tool logic: validates input, fetches chemical data from SureChEMBL API using chemical ID, extracts global_frequency, computes category and rarity score using helpers, and returns formatted statistics.
    private async handleGetChemicalFrequency(args: any) {
      if (!args || typeof args.chemical_id !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid chemical ID');
      }
    
      try {
        const response = await this.apiClient.get(`/chemical/id/${args.chemical_id}`);
        const chemical = response.data.data?.[0];
    
        if (!chemical) {
          throw new Error('Chemical not found');
        }
    
        const frequencyStats = {
          chemical_id: args.chemical_id,
          name: chemical.name,
          global_frequency: chemical.global_frequency || 0,
          frequency_analysis: {
            total_occurrences: chemical.global_frequency || 0,
            frequency_category: this.categorizeFrequency(chemical.global_frequency || 0),
            rarity_score: this.calculateRarityScore(chemical.global_frequency || 0)
          },
          chemical_info: {
            smiles: chemical.smiles,
            molecular_weight: chemical.mol_weight,
            inchi_key: chemical.inchi_key
          }
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(frequencyStats, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get chemical frequency: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • Input schema defining the required 'chemical_id' parameter as a string.
    inputSchema: {
      type: 'object',
      properties: {
        chemical_id: { type: 'string', description: 'SureChEMBL chemical ID' },
      },
      required: ['chemical_id'],
    },
  • src/index.ts:499-509 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    {
      name: 'get_chemical_frequency',
      description: 'Get frequency statistics for chemicals across the patent database',
      inputSchema: {
        type: 'object',
        properties: {
          chemical_id: { type: 'string', description: 'SureChEMBL chemical ID' },
        },
        required: ['chemical_id'],
      },
    },
  • src/index.ts:572-573 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement, routing calls to the handler.
    case 'get_chemical_frequency':
      return await this.handleGetChemicalFrequency(args);
  • Helper function to categorize the global frequency into descriptive buckets, used in the handler.
    private categorizeFrequency(frequency: number): string {
      if (frequency === 0) return 'Not found';
      if (frequency === 1) return 'Unique';
      if (frequency <= 10) return 'Very rare';
      if (frequency <= 100) return 'Rare';
      if (frequency <= 1000) return 'Uncommon';
      if (frequency <= 10000) return 'Common';
      return 'Very common';
    }
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 only states what the tool does without behavioral details. It lacks information on permissions, rate limits, response format, or whether it's read-only (implied by 'Get' but not explicit), which is insufficient for a tool with no annotation coverage.

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 waste. It's front-loaded with the core purpose and appropriately sized for the tool's complexity, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool has 1 parameter with full schema coverage but no annotations or output schema, the description is minimally adequate. It clarifies the purpose but lacks behavioral context and usage guidelines, making it incomplete for optimal agent decision-making in a server with many sibling tools.

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?

The schema description coverage is 100%, with the single parameter 'chemical_id' documented as 'SureChEMBL chemical ID'. The description adds no additional parameter semantics beyond this, so it meets the baseline score of 3 for high schema coverage without extra value.

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 ('Get') and resource ('frequency statistics for chemicals across the patent database'), making the purpose understandable. However, it doesn't explicitly differentiate from siblings like 'get_patent_statistics' or 'get_chemical_properties', which could have overlapping statistical or chemical focus.

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. It doesn't mention prerequisites, exclusions, or compare to siblings such as 'get_patent_statistics' or 'search_chemicals_by_name', leaving the agent to infer usage context.

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/SureChEMBL-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server