Version: 0.1.0
Last Update: 2025/06/05
MCP Support
Python Calling Support
Conduct single-step retrosynthesis. Given the product(s), predict multiple sets of potential reactants, along with their confidence.
Example
Input:
product_smiles: 'CCO'
Text Input (used for the run_text
function in the Python calling mode):
product_smiles: 'CCO'
Output:
"""There are 13 possible sets of reactants for the given product:
1. Reactants: C1CCOC1.CCNC(=O)c1cccn1C.[Li][AlH4] Confidence: 1.0
2. Reactants: CCN.CCO.Cn1cccc1C=O.[BH4-].[Na+] Confidence: 1.0
3. Reactants: CCN.CO.Cn1cccc1C=O.[BH4-].[Na+] Confidence: 1.0
4. Reactants: CCN.Cn1cccc1C=O.[BH4-].[Na+] Confidence: 1.0
5. Reactants: CCN.CCO.Cn1cccc1C=O.O.[BH4-].[Na+] Confidence: 1.0
6. Reactants: CCN.CO.Cn1cccc1C=O.O.[BH4-].[Na+] Confidence: 1.0
7. Reactants: C1CCOC1.CCN.Cn1cccc1C=O.[BH4-].[Na+] Confidence: 1.0
8. Reactants: CCN.Cl.Cn1cccc1C=O Confidence: 0.938
9. Reactants: CCN.Cn1cccc1C=O Confidence: 0.917
10. Reactants: CCN.Cl.Cn1cccc1C=O Confidence: 0.841
11. Reactants: C1CCOC1.CCN.Cn1cccc1C=O Confidence: 0.797
12. Reactants: C1CCOC1.CCN.CO.Cn1cccc1C=O Confidence: 0.647
13. Reactants: C1CCOC1.CC(=O)NCc1cccn1C.[Li][AlH4] Confidence: 1.0"""
Usage
The tool supports both MCP mode and Python calling mode.
Environment Variables
This tool requires the following environment variables:
- RXN4CHEM_API_KEY: The API key for IBM RXN4Chem.
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", "Retrosynthesis"],
"toolCallTimeoutMillis": 300000,
"env": {
"RXN4CHEM_API_KEY": "VALUE_TO_BE_SET"
}
}
Python Calling Mode
import os
from chemmcp.tools import Retrosynthesis
# Set the environment variables
os.environ['RXN4CHEM_API_KEY'] = 'VALUE_TO_BE_SET'
# Initialize the tool
tool = Retrosynthesis()
# The tool has two alternative ways to run:
# 1. Run with separate input domains (recommended)
output = tool.run_code(
product_smiles='CCO'
)
# 2. Run with text-only input
output = tool.run_text(
product_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 |
---|---|---|---|
product_smiles | str | N/A | The SMILES of the product. |
Text Input
Used in the run_text
function in the Python calling mode.
Name | Type | Default | Description |
---|---|---|---|
product_smiles | str | N/A | The SMILES of the product. |
Output
The output is the same in both input cases.
Name | Type | Description |
---|---|---|
reactants_and_confidence | str | The SMILES of the reactants and the confidence. |
Envs
Name | Description |
---|---|
RXN4CHEM_API_KEY | The API key for IBM RXN4Chem. |
Implementation Details
- Implementation Description: Uses the IBM RXN for Chem API to do single-step retrosynthesis. Outputs all possible reactants and their confidence, sorted by confidence in descending order.
- Open-source dependencies (code source or required libraries):
- ChemCrow (MIT)
- rxn4chemistry (MIT)
- Hosted services and software (required for running the tool):