Skip to main content
Glama

get_compound_synonyms

Retrieve all names and synonyms for a chemical compound using its PubChem Compound ID (CID). This tool helps identify alternative names and terminology for substances in the PubChem database.

Instructions

Get all names and synonyms for a compound

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesPubChem Compound ID (CID)

Implementation Reference

  • Main execution logic for get_compound_synonyms tool: validates CID input, calls PubChem API for synonyms, returns JSON response.
    private async handleGetCompoundSynonyms(args: any) {
      if (!isValidCidArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid CID arguments');
      }
    
      try {
        const response = await this.apiClient.get(`/compound/cid/${args.cid}/synonyms/JSON`);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get compound synonyms: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • Tool registration entry including name, description, and input schema (requires 'cid' as number or string). Serves both registration and schema purposes.
    {
      name: 'get_compound_synonyms',
      description: 'Get all names and synonyms for a compound',
      inputSchema: {
        type: 'object',
        properties: {
          cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' },
        },
        required: ['cid'],
      },
    },
  • src/index.ts:750-751 (registration)
    Dispatcher case in CallToolRequestSchema handler that routes calls to the tool's handler function.
    case 'get_compound_synonyms':
      return await this.handleGetCompoundSynonyms(args);
  • Type guard function for validating CID-based arguments, used in the handler for input validation.
    const isValidCidArgs = (
      args: any
    ): args is { cid: number | string; format?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        (typeof args.cid === 'number' || typeof args.cid === 'string') &&
        (args.format === undefined || ['json', 'sdf', 'xml', 'asnt', 'asnb'].includes(args.format))
      );
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data ('Get all names and synonyms'), implying a read-only operation, but does not cover aspects like rate limits, authentication needs, error handling, or the format of returned data. This leaves significant gaps in understanding how the tool behaves in practice.

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, clear sentence that efficiently conveys the tool's purpose without any unnecessary words. It is front-loaded and to the point, making it easy for an agent to parse quickly, which is ideal for conciseness.

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 incomplete for effective tool use. It does not explain what the return values look like (e.g., list format, data structure) or address potential complexities like handling invalid CIDs. For a tool with no structured behavioral hints, more context is needed to ensure reliable agent invocation.

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 input schema has 100% description coverage, with the 'cid' parameter clearly documented as 'PubChem Compound ID (CID)'. The description does not add any additional meaning beyond this, such as examples or constraints, but since the schema is comprehensive, a baseline score of 3 is appropriate as it meets minimum viability 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 tool's purpose with a specific verb ('Get') and resource ('all names and synonyms for a compound'), making it easy to understand what it does. However, it does not explicitly differentiate from sibling tools like 'get_compound_info' or 'get_compound_properties', which might also provide related information, so it falls short of a perfect score.

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. With many sibling tools available, such as 'get_compound_info' or 'search_compounds', there is no indication of specific contexts, prerequisites, or exclusions for using this tool, leaving the agent to infer usage based on the name 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/k-lordbodin7/PubChem-MCP-Server'

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