Skip to main content
Glama
Augmented-Nature

Unofficial PubChem MCP Server

get_compound_info

Retrieve detailed chemical compound data from PubChem using the Compound ID, including molecular properties and bioassay information in multiple output formats.

Instructions

Get detailed information for a specific compound by PubChem CID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesPubChem Compound ID (CID)
formatNoOutput format (default: json)

Implementation Reference

  • The core handler function for the 'get_compound_info' tool. Validates input using isValidCidArgs, fetches compound data from PubChem REST API by CID in specified format (default JSON), and returns the response as text content.
    private async handleGetCompoundInfo(args: any) {
      if (!isValidCidArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid CID arguments');
      }
    
      try {
        const format = args.format || 'json';
        const response = await this.apiClient.get(`/compound/cid/${args.cid}/${format === 'json' ? 'JSON' : format}`);
    
        return {
          content: [
            {
              type: 'text',
              text: format === 'json' ? JSON.stringify(response.data, null, 2) : String(response.data),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get compound info: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • Tool definition in ListTools response, including name, description, and input schema for validation (cid required, format optional).
    {
      name: 'get_compound_info',
      description: 'Get detailed information for a specific compound by PubChem CID',
      inputSchema: {
        type: 'object',
        properties: {
          cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' },
          format: { type: 'string', enum: ['json', 'sdf', 'xml', 'asnt', 'asnb'], description: 'Output format (default: json)' },
        },
        required: ['cid'],
      },
    },
  • src/index.ts:742-743 (registration)
    Switch case in CallToolRequest handler that routes 'get_compound_info' tool calls to the handleGetCompoundInfo method.
    case 'get_compound_info':
      return await this.handleGetCompoundInfo(args);
  • Type guard function validating input arguments for get_compound_info tool, matching the input schema.
      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 full burden for behavioral disclosure. While 'Get detailed information' implies a read-only operation, it doesn't specify what 'detailed information' includes, whether there are rate limits, authentication requirements, or how results are structured. This leaves significant behavioral aspects undocumented.

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 immediately conveys the core purpose without any wasted words. It's appropriately sized for a simple lookup tool and front-loads the essential information.

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 tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'detailed information' includes, how results are structured, or any limitations. Given the complexity implied by having 28 sibling tools in this domain, more context about the scope and boundaries of this tool is needed.

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 fully documents both parameters (cid and format). The description adds no additional parameter semantics beyond what's in the schema, such as explaining what constitutes valid CID values or format implications. Baseline 3 is appropriate when schema does all the work.

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 action ('Get detailed information') and resource ('for a specific compound by PubChem CID'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_compound_properties' or 'get_compound_bioactivities', which likely provide more specific subsets of compound information.

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 offering specialized compound data (e.g., properties, bioactivities, synonyms), there's no indication whether this is a comprehensive information source or how it relates to other compound-related tools.

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