Skip to main content
Glama
Augmented-Nature

PubChem MCP Server

get_compound_info

Retrieve detailed compound information by PubChem CID, including structure, properties, and bioassay data. Supports multiple output formats like JSON, SDF, and XML for flexible data access.

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 main handler function that validates input, fetches compound information from PubChem API using the provided CID, and returns the data in the specified format.
    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'}`
        );
      }
    }
  • The input schema definition for the get_compound_info tool, specifying parameters cid (required) and optional format.
    {
      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)
    The switch case in CallToolRequestSchema handler that routes calls to get_compound_info to its handler function.
    case 'get_compound_info':
      return await this.handleGetCompoundInfo(args);
  • Type guard function to validate arguments for CID-based tools like get_compound_info.
    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?

With no annotations provided, the description carries the full burden of behavioral disclosure but provides minimal information. It doesn't indicate whether this is a read-only operation, what kind of authentication might be required, potential rate limits, error conditions, or what 'detailed information' actually includes. The description is functional but lacks important behavioral context.

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 gets straight to the point with zero wasted words. It's appropriately sized for a straightforward lookup tool and front-loads the essential information without unnecessary elaboration.

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, what format the output takes, or provide any context about the scope or limitations of the information returned. Given the complexity implied by the sibling tools (which handle specific aspects like properties, bioactivities, safety data), this description should clarify what comprehensive information it provides.

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?

With 100% schema description coverage, the schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema - it mentions 'PubChem CID' which the schema already covers, and doesn't elaborate on format choices or provide examples. This meets the baseline for high schema coverage.

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 target resource ('specific compound by PubChem CID'), which distinguishes it from siblings like get_compound_properties or get_compound_synonyms that retrieve specific subsets of information. However, it doesn't explicitly differentiate from batch_compound_lookup or search_compounds, which could also retrieve compound information through different mechanisms.

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 when to prefer this over batch_compound_lookup for single compounds, or when to use get_compound_properties versus this more comprehensive information retrieval. There's no context about prerequisites or typical use cases.

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

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

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