Version: 0.1.0
Last Update: 2025/06/05
MCP Support
Python Calling Support
Check online and generate a summary covering its safety information, including its GHS classification, health and laboratory safety, and societal concerns.
Example
Input:
representation_name: 'SMILES'
representation: 'CCO'
Text Input (used for the run_text
function in the Python calling mode):
representation_name_and_representation: 'SMILES: CCO'
Output:
"""**Name: Operator Safety**: Ethanol is highly flammable and can cause eye and skin irritation upon contact. It is recommended to use personal protective equipment, ensure good ventilation, and avoid any ignition sources when handling ethanol.
**Name: GHS Information**: Ethanol has the GHS signal word "Danger" and is classified as Flammable Liquid Category 2 and Eye Irritation Category 2. These classifications mean that ethanol requires precautions to prevent fires and protect the eyes from irritation, such as using flame-resistant containers and eyewear protection.
**Name: Environmental Risks**: Ethanol is moderately harmful to aquatic life with long-term exposure, suggesting caution to prevent its release into waterways.
**Name: Societal Impact**: Ethanol is not a controlled substance but is widely used in alcoholic beverages, regulated for consumption due to its psychoactive effects. It is not considered a chemical weapon or illegal in terms of chemical safety."""
Usage
The tool supports both MCP mode and Python calling mode.
Environment Variables
This tool requires the following environment variables:
- LLM_MODEL_NAME: The name of the LLM to use. See LiteLLM for more details.
- Other LLM credentials are required to be set in the
env
field. See LiteLLM for more details.
MCP Mode
Configure your MCP client following its instructions with something like:
{
"command": "/ABSTRACT/PATH/TO/uv", // Use `which uv` to get its path
"args": ["--directory", "/ABSTRACT/PATH/TO/ChemMCP", "run", "--tools", "SafetyCheck"],
"toolCallTimeoutMillis": 300000,
"env": {
"LLM_MODEL_NAME": "VALUE_TO_BE_SET"
// Add required LLM credentials
// ...
}
}
Python Calling Mode
import os
from chemmcp.tools import SafetyCheck
# Set the environment variables
os.environ['LLM_MODEL_NAME'] = 'VALUE_TO_BE_SET'
# Also add LLM credentials required by the LLM model, such as `OPENAI_API_KEY`
# Initialize the tool
tool = SafetyCheck()
# The tool has two alternative ways to run:
# 1. Run with separate input domains (recommended)
output = tool.run_code(
representation_name='SMILES'
representation='CCO'
)
# 2. Run with text-only input
output = tool.run_text(
representation_name_and_representation='SMILES: CCO'
)
Each tool in ChemMCP has two ways to run:
run_code
(recommended): The inputs contain one or more domains, each of which can be a str, an int, a float, etc.run_text
: The inputs are a single string in a specific format. The tool will parse the string to extract the input domains. This is useful in scenarios where an agent framework calls tools only with text input. The output is the same in both cases.
For the input and output domains, please refer to the tool’s signature.
Tool Signature
Input
Used in the MCP mode, as well as the run_code
function in the Python calling mode.
Name | Type | Default | Description |
---|---|---|---|
representation_name | str | N/A | The representation name, can be “SMILES”, “IUPAC”, or “Name” (chemical’s common name). |
representation | str | N/A | The representation of the molecule/compound, corresponding to the representation_name used. |
Text Input
Used in the run_text
function in the Python calling mode.
Name | Type | Default | Description |
---|---|---|---|
representation_name_and_representation | str | N/A | The representation name and representation of the molecule/compound, e.g., “SMILES: |
Output
The output is the same in both input cases.
Name | Type | Description |
---|---|---|
safety_summary | str | The safety summary of the molecule/compound. |
Envs
Name | Description |
---|---|
LLM_MODEL_NAME | The name of the LLM to use. See LiteLLM for more details. |
LLM credentials | Other LLM credentials are required to be set in the env field. See LiteLLM for more details. |
Implementation Details
- Implementation Description: Uses PubChem’s safety data to provide comprehensive safety information about a molecule, including hazard statements, precautionary statements, and other safety-related data. Also compares the molecule with a database of controlled chemicals to check if it is a controlled chemical or similar to a controlled chemical.
- Open-source dependencies (code source or required libraries):
- ChemCrow (MIT)
- Hosted services and software (required for running the tool):
- PubChem
- Custom LLMs