Skip to main content
Glama

get_safety_data

Retrieve GHS hazard classifications and safety information for chemical compounds using PubChem Compound IDs.

Instructions

Get GHS hazard classifications and safety information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesPubChem Compound ID (CID)

Implementation Reference

  • Implements the core logic of the get_safety_data tool: validates CID input, fetches safety classification data from PubChem API, and returns formatted 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'}`
        );
      }
    }
  • Defines the tool metadata including name, description, and input schema requiring a PubChem 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)
    Registers the tool dispatch in the CallToolRequestSchema switch statement, routing calls to the handler method.
    case 'get_safety_data':
      return await this.handleGetSafetyData(args);
  • src/index.ts:732-733 (registration)
    Registers the tool in the list returned by ListToolsRequestSchema, making it discoverable by clients.
    }));
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. It states the tool retrieves data but doesn't mention any behavioral traits like rate limits, authentication needs, response formats, or potential errors. This is a significant gap for a tool with no structured safety hints.

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 without any wasted words. It is appropriately sized for a simple lookup tool, making it easy for an agent to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the returned safety information includes, how it's structured, or any limitations, which is crucial for an agent to use the tool effectively in a complex domain like chemical safety.

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 'cid' parameter clearly documented as 'PubChem Compound ID (CID)'. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints, so it 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 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 from sibling tools like 'get_toxicity_info' or 'get_regulatory_info', which might overlap in safety-related domains, preventing a perfect score.

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, such as 'get_toxicity_info' or 'get_regulatory_info', which are listed as siblings. It lacks context on specific use cases, exclusions, or prerequisites, leaving the agent to infer usage based on the tool name 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