skills/molecular-properties-calculation/SKILL.md
Calculate basic molecular properties from SMILES including molecular weight, formula, atom counts, and exact mass.
npx skillsauth add InternScience/scp molecular-properties-calculationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
import asyncio
import json
from fastmcp import Client
from fastmcp.client.transports import StreamableHttpTransport
class ChemicalToolsClient:
"""Chemical Tools MCP Client using FastMCP"""
def __init__(self, server_url: str, headers: dict = None):
self.server_url = server_url
self.headers = headers or {}
self.client = None
async def connect(self):
"""Establish connection and initialize session"""
print(f"Connecting to: {self.server_url}")
try:
transport = StreamableHttpTransport(
url=self.server_url,
headers=self.headers
)
self.client = Client(transport)
await self.client.__aenter__()
print(f"✓ connect success")
return True
except Exception as e:
print(f"✗ connect failure: {e}")
import traceback
traceback.print_exc()
return False
async def disconnect(self):
"""Disconnect from server"""
try:
if self.client:
await self.client.__aexit__(None, None, None)
print("✓ already disconnect")
except Exception as e:
print(f"✗ disconnect error: {e}")
def parse_result(self, result):
"""Parse MCP tool call result"""
try:
if hasattr(result, 'content') and result.content:
content = result.content[0]
if hasattr(content, 'text'):
try:
return json.loads(content.text)
except:
return content.text
return str(result)
except Exception as e:
return {"error": f"parse error: {e}", "raw": str(result)}
This workflow calculates fundamental molecular properties from SMILES strings, useful for drug discovery, chemical analysis, and computational chemistry.
Workflow Steps:
Implementation:
## Initialize client
HEADERS = {"SCP-HUB-API-KEY": "<your-api-key>"}
client = ChemicalToolsClient(
"https://scp.intern-ai.org.cn/api/v1/mcp/31/SciToolAgent-Chem",
HEADERS
)
if not await client.connect():
print("connection failed")
exit()
## Input: SMILES string to analyze
smiles = "CCO" # Ethanol
print(f"=== Molecular Properties for {smiles} ===\n")
## Step 1: Calculate molecular weight
print("Step 1: Molecular Weight")
result = await client.client.call_tool(
"SMILESToWeight",
arguments={"smiles": smiles}
)
result_data = client.parse_result(result)
print(f"{result_data}\n")
## Step 2: Calculate molecular formula
print("Step 2: Molecular Formula")
result = await client.client.call_tool(
"GetMolFormula",
arguments={"smiles": smiles}
)
result_data = client.parse_result(result)
print(f"{result_data}\n")
## Step 3: Calculate exact molecular weight
print("Step 3: Exact Molecular Weight")
result = await client.client.call_tool(
"GetExactMolceularWeight",
arguments={"smiles": smiles}
)
result_data = client.parse_result(result)
print(f"{result_data}\n")
## Step 4: Count atoms
print("Step 4: Atom Count")
result = await client.client.call_tool(
"GetAtomsNum",
arguments={"smiles": smiles}
)
result_data = client.parse_result(result)
print(f"{result_data}\n")
## Step 5: Count heavy atoms
print("Step 5: Heavy Atom Count")
result = await client.client.call_tool(
"GetHeavyAtomsNum",
arguments={"smiles": smiles}
)
result_data = client.parse_result(result)
print(f"{result_data}\n")
await client.disconnect()
SciToolAgent-Chem Server:
SMILESToWeight: Calculate average molecular weight
smiles (str) - SMILES stringGetMolFormula: Calculate molecular formula
smiles (str) - SMILES stringGetExactMolceularWeight: Calculate exact (monoisotopic) molecular weight
smiles (str) - SMILES stringGetAtomsNum: Count total number of atoms
smiles (str) - SMILES stringGetHeavyAtomsNum: Count heavy atoms (non-hydrogen)
smiles (str) - SMILES stringInput:
smiles: Molecule in SMILES format (e.g., "CCO", "c1ccccc1", "CC(=O)O")Output:
Example:
The SciToolAgent-Chem server provides 160+ additional tools including:
GetRotatableBondsNum: Count rotatable bondsGetHBDNum/GetHBANum: Hydrogen bond donors/acceptorsGetRingsNum: Count ring systemsGetTPSA: Calculate topological polar surface area (TPSA)GetCrippenDescriptors: Calculate logP and molar refractivityGetLipinskiHBDNum/GetLipinskiHBANum: Lipinski rule parametersGetAromaticRingsNum: Count aromatic ringsGetFractionCSP3: Calculate fraction of sp³ carbonsFor drug-likeness, molecules should satisfy:
Use the property calculation tools to assess these criteria.
testing
Assess wind energy potential and perform site analysis using atmospheric science calculations.
tools
Scientific Literature Mining - Mine scientific literature: PubMed search, arXiv search, web search, and Tavily deep search. Use this skill for scientific informatics tasks involving pubmed search search literature search web tavily search. Combines 4 tools from 2 SCP server(s).
tools
Virus Genomics Analysis - Analyze virus genomics: NCBI virus dataset, annotation, taxonomy, and literature search. Use this skill for virology tasks involving get virus dataset report get virus annotation report get taxonomy search literature. Combines 4 tools from 2 SCP server(s).
tools
Virtual Screening Pipeline - Virtual screening: search PubChem by substructure, compute similarity, filter by drug-likeness, and predict binding affinity. Use this skill for drug discovery tasks involving search pubchem by smiles calculate smiles similarity calculate mol drug chemistry boltz binding affinity. Combines 4 tools from 3 SCP server(s).