← 返回
开发者工具 中文

Intern PubChem Name Conversion

Convert molecules between IUPAC, SMILES, and molecular formula using PubChem as the source of truth. Use this whenever the user asks to convert, normalize, o...
使用PubChem作为权威来源,在IUPAC名称、SMILES和分子式之间转换分子。用户请求转换、规范化等操作时使用。
guox18
开发者工具 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 1
Stars
📥 604
下载
💾 10
安装
1
版本
#chemistry#latest#name-conversion#pubchem#science

概述

Intern PubChem Name Conversion

Convert one molecular representation into all three fields:

  • smiles
  • iupac
  • formula

When to use

Use this skill when the user asks to:

  • convert IUPAC <-> SMILES
  • fetch molecular formula from IUPAC/SMILES
  • validate molecule identity against PubChem

Do not use this skill for:

  • reaction mechanism explanation
  • quantum chemistry simulation
  • docking or property prediction beyond PubChem identifiers

Input contract

Expect one input value and one type:

  • input_type: iupac or smiles
  • input_value: raw string

If the user gives only one string without type:

  • treat strings with many bond symbols (=, #, [, ], @) as smiles
  • otherwise treat as iupac/name query

Required behavior

Always query PubChem first. Do not answer from memory when tools are available.

1) URL-encode the full input string:

ENCODED=$(python3 -c 'import urllib.parse,sys; print(urllib.parse.quote(sys.argv[1], safe=""))' "$INPUT_VALUE")

2) Build the primary endpoint:

  • If input_type == iupac:
  • https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/{ENCODED}/property/SMILES,IUPACName,MolecularFormula/JSON
  • If input_type == smiles:
  • https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/{ENCODED}/property/SMILES,IUPACName,MolecularFormula/JSON

3) If smiles primary endpoint is non-200, retry once with:

  • https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastidentity/smiles/{ENCODED}/property/SMILES,IUPACName,MolecularFormula/JSON

4) If still non-200, do CID fallback:

  • Resolve CID:
  • iupac: .../compound/name/{ENCODED}/cids/JSON
  • smiles: .../compound/smiles/{ENCODED}/cids/JSON
  • Then fetch properties by CID:
  • .../compound/cid/{CID}/property/SMILES,IUPACName,MolecularFormula/JSON

5) Parse PropertyTable.Properties[0] and map:

  • smiles <- SMILES (fallback ConnectivitySMILES)
  • iupac <- IUPACName
  • formula <- MolecularFormula

Output format

Return JSON only (no markdown fences, no extra prose):

{
  "smiles": "...",
  "iupac": "...",
  "formula": "..."
}

If all attempts fail, still return the same schema with empty strings:

{
  "smiles": "",
  "iupac": "",
  "formula": ""
}

Quality rules

  • Keep PubChem values verbatim; do not rewrite or normalize names.
  • If multiple records are returned, use the first record consistently.
  • Do not silently swap stereochemistry markers.

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-30 09:49 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,682
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,601
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,964