Skip to main content
Glama
Augmented-Nature

Unofficial PubChem MCP Server

get_compound_synonyms

Retrieve all names and synonyms for a chemical compound using its PubChem CID to identify substances across different naming conventions.

Instructions

Get all names and synonyms for a compound

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesPubChem Compound ID (CID)

Implementation Reference

  • The main execution handler for the get_compound_synonyms tool. Validates the input using isValidCidArgs, calls the PubChem API to retrieve synonyms for the given CID, and returns the JSON response as text content.
    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'}`
        );
      }
    }
  • src/index.ts:428-438 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the tool name, description, and input schema requiring a 'cid' parameter of type number or string.
    {
      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'],
      },
    },
  • Input schema definition for the get_compound_synonyms tool, specifying an object with a required 'cid' property that accepts number or string.
    inputSchema: {
      type: 'object',
      properties: {
        cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' },
      },
      required: ['cid'],
    },
  • src/index.ts:750-751 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to the get_compound_synonyms tool to its handler function.
    case 'get_compound_synonyms':
      return await this.handleGetCompoundSynonyms(args);
  • Helper validation function isValidCidArgs used by the handler to check input arguments, ensuring 'cid' is number or string and optional 'format' is valid.
    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 action but lacks details on permissions, rate limits, response format, or error handling. For a read operation with no annotation coverage, this leaves significant gaps in understanding how the tool 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 that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured.

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's simplicity (one parameter, read-only operation) and lack of output schema, the description is minimally adequate but incomplete. It covers the basic purpose but fails to address behavioral aspects like response format or usage context, which are important for effective tool selection.

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 parameter 'cid' fully documented as 'PubChem Compound ID (CID)'. The description does not add any extra meaning beyond this, such as format examples or constraints, so it meets the baseline for adequate but not enhanced parameter semantics.

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 the resource 'all names and synonyms for a compound', making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'get_compound_info' or 'get_compound_properties', which might also retrieve related data, 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, such as 'get_compound_info' or 'search_compounds', which might offer overlapping or complementary functionality. There is no mention of prerequisites, exclusions, or specific contexts for usage.

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/Augmented-Nature-PubChem-MCP-Server'

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