Skip to main content
Glama

get_compound_info

Retrieve detailed chemical information for compounds using PubChem Compound IDs, including structure data, properties, bioactivity, and safety information.

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 handler function that implements the core logic of the 'get_compound_info' tool. It validates input arguments using isValidCidArgs, fetches compound data from the PubChem API based on the provided CID and optional format, 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'}`
        );
      }
    }
  • src/index.ts:383-394 (registration)
    The tool registration entry in the ListToolsRequestSchema handler, defining the name, description, and input schema for 'get_compound_info'.
    {
      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'],
      },
    },
  • The input schema defining the expected parameters for the 'get_compound_info' tool: cid (required, number or string) and optional format.
    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'],
    },
  • Helper validation function isValidCidArgs used by the handler to validate input arguments for CID and optional format.
    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))
      );
    };
  • src/index.ts:742-743 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to 'get_compound_info' to the appropriate handler method.
    case 'get_compound_info':
      return await this.handleGetCompoundInfo(args);
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. It states the action but lacks behavioral details such as rate limits, authentication needs, error handling, or what 'detailed information' includes (e.g., structure, properties, references). For a read operation with no annotation coverage, this is a significant gap in transparency.

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 front-loads the core purpose with zero waste. Every word earns its place, making it highly concise and well-structured for quick comprehension.

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 no annotations and no output schema, the description is minimally adequate but incomplete. It specifies the action and key parameter (CID) but omits behavioral context and output details. For a tool with 2 parameters and rich sibling tools, it should do more to guide usage and set expectations.

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%, with both parameters (cid, format) well-documented in the schema. The description adds no additional parameter semantics beyond implying the tool uses PubChem CID, which is already covered. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get detailed information') and resource ('for a specific compound by PubChem CID'), making the purpose specific and unambiguous. It distinguishes from siblings like get_compound_properties or get_compound_synonyms by emphasizing comprehensive 'detailed information' rather than specific subsets.

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 (e.g., get_compound_properties, get_compound_synonyms, search_compounds), it lacks explicit when/when-not instructions or named alternatives, leaving the agent to infer usage from context 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