Skip to main content
Glama
Augmented-Nature

Unofficial PubChem MCP Server

get_safety_data

Retrieve GHS hazard classifications and safety information for chemical compounds using PubChem Compound IDs to assess chemical risks and ensure safe handling.

Instructions

Get GHS hazard classifications and safety information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesPubChem Compound ID (CID)

Implementation Reference

  • The handler function that implements the core logic of get_safety_data: validates CID input and fetches PubChem classification data (safety/GHS info).
    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:640-649 (registration)
    Tool registration entry in ListToolsRequestSchema handler, defining name, description, and input schema.
      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'],
      },
    },
  • Dispatcher switch case that invokes the get_safety_data handler.
    case 'get_safety_data':
      return await this.handleGetSafetyData(args);
  • Input schema definition for get_safety_data tool requiring a CID.
    inputSchema: {
      type: 'object',
      properties: {
        cid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' },
      },
      required: ['cid'],
    },
  • Helper validation function for CID arguments, used in get_safety_data handler.
      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 what the tool does ('Get GHS hazard classifications and safety information') but doesn't describe how it behaves—e.g., whether it's a read-only operation, what format the information is returned in, if there are rate limits, or if it requires specific permissions. For a tool with zero 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 states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly. Every word earns its place.

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?

Given the complexity of safety data retrieval and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'GHS hazard classifications and safety information' entails, how the data is structured, or what the return values look like. For a tool with no annotations and no output schema, the description should provide more context to help the agent understand the tool's behavior and outputs.

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 input schema has 100% description coverage, with the single parameter 'cid' documented as 'PubChem Compound ID (CID)'. The description adds no additional parameter information beyond what's in the schema. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline score is 3 even with no param info in the description, which applies here.

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 tool's purpose with a specific verb ('Get') and resource ('GHS hazard classifications and safety information'), making it immediately understandable. However, it doesn't explicitly differentiate this tool from similar siblings like 'get_toxicity_info' or 'get_regulatory_info', which might also provide safety-related data. The description is accurate but lacks sibling differentiation.

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 available (e.g., 'get_toxicity_info', 'get_regulatory_info', 'assess_environmental_fate'), there's no indication of what makes this tool distinct or when it should be preferred. The agent must infer usage from the tool name and description 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/Augmented-Nature/Augmented-Nature-PubChem-MCP-Server'

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