Skip to main content
Glama
Augmented-Nature

PubChem MCP Server

get_safety_data

Retrieve GHS hazard classifications and safety information for chemical compounds using PubChem Compound IDs with this dedicated tool.

Instructions

Get GHS hazard classifications and safety information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesPubChem Compound ID (CID)

Implementation Reference

  • The main handler function that implements the get_safety_data tool. Validates input CID, fetches classification/safety data from PubChem API, and returns JSON response.
    private async handleGetSafetyData(args: any) {
      if (!isValidCidArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid CID arguments');
      }
    
      try {
        const response = await this.apiClient.get(`/compound/cid/${args.cid}/classification/JSON`);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get safety data: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • src/index.ts:639-649 (registration)
    Tool registration entry in the ListToolsRequestSchema handler, defining the tool name, description, and input schema requiring a CID.
    {
      name: 'get_safety_data',
      description: 'Get GHS hazard classifications and safety information',
      inputSchema: {
        type: 'object',
        properties: {
          cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' },
        },
        required: ['cid'],
      },
    },
  • src/index.ts:792-793 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes get_safety_data calls to the specific handler method.
    case 'get_safety_data':
      return await this.handleGetSafetyData(args);
  • Helper validation function used by get_safety_data handler to validate input arguments, specifically checking for valid CID.
    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 full burden for behavioral disclosure. While 'Get' implies a read-only operation, the description doesn't clarify whether this requires authentication, has rate limits, returns structured or unstructured data, or has any side effects. For a tool with no annotation coverage, this leaves significant behavioral questions unanswered.

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 states exactly what the tool does with zero wasted words. It's appropriately sized for a simple lookup tool and front-loads the core functionality 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 'GHS hazard classifications' specifically include, what format the safety information returns, or how this differs from related sibling tools. The agent would need to guess about the output structure and appropriate usage context.

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 input schema already fully documents the single 'cid' parameter as a PubChem Compound ID. The description adds no additional parameter context beyond what the schema provides - it doesn't explain what GHS classifications are, what format the safety information takes, or how the CID maps to the output. 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 verb 'Get' and the resource 'GHS hazard classifications and safety information', making the purpose immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'get_toxicity_info' or 'get_regulatory_info', which likely provide related but distinct safety-related data.

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 multiple sibling tools that might provide overlapping or complementary safety information (get_toxicity_info, get_regulatory_info, assess_environmental_fate), the agent receives no help in choosing between them. There's no mention of prerequisites, limitations, 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