Skip to main content
  1. ChemMCP Tools/

MoleculeGenerator (generate_molecule_from_description)

Molecule Molecular Information Text Neural Networks SMILES
Table of Contents
Version: 0.1.0 Last Update: 2025/06/05 MCP Support Python Calling Support
Generate a molecule represented in SMILES with MolT5 that matches the given textual description.

Example

Input:

description: 'The molecule is an ether in which the oxygen atom is linked to two ethyl groups. It has a role as an inhalation anaesthetic, a non-polar solvent and a refrigerant. It is a volatile organic compound and an ether.'

Text Input (used for the run_text function in the Python calling mode):

description: 'The molecule is an ether in which the oxygen atom is linked to two ethyl groups. It has a role as an inhalation anaesthetic, a non-polar solvent and a refrigerant. It is a volatile organic compound and an ether.'

Output:

"""CCO

Note: This is a generated SMILES and may not be accurate. Please double check the result."""

Usage

The tool supports both MCP mode and Python calling mode.

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", "MoleculeGenerator"],
    "toolCallTimeoutMillis": 300000,
    "env": {}
}

Python Calling Mode

import os
from chemmcp.tools import MoleculeGenerator

# Initialize the tool
tool = MoleculeGenerator()

# The tool has two alternative ways to run:
# 1. Run with separate input domains (recommended)
output = tool.run_code(
    description='The molecule is an ether in which the oxygen atom is linked to two ethyl groups. It has a role as an inhalation anaesthetic, a non-polar solvent and a refrigerant. It is a volatile organic compound and an ether.'
)
# 2. Run with text-only input
output = tool.run_text(
    description='The molecule is an ether in which the oxygen atom is linked to two ethyl groups. It has a role as an inhalation anaesthetic, a non-polar solvent and a refrigerant. It is a volatile organic compound and an ether.'
)

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.

NameTypeDefaultDescription
descriptionstrN/ATextual description of the molecule.

Text Input

Used in the run_text function in the Python calling mode.

NameTypeDefaultDescription
descriptionstrN/ATextual description of the molecule.

Output

The output is the same in both input cases.

NameTypeDescription
smilesstrSMILES representation of the molecule.

Envs

No required environment variables for this tool.

Implementation Details

  • Implementation Description: Uses the MolT5-large model, a transformer-based neural network trained on molecule-text pairs, to generate SMILES representations from natural language descriptions.
  • Open-source dependencies (code source or required libraries):
  • Hosted services and software (required for running the tool): None