Skip to main content
skill CX Codex

tooluniverse-sdk — Claude Code skill: Python SDK for AI scientists

Teaches your agent to write ToolUniverse Python SDK code: three calling patterns, batch runs and embedding-based tool search.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add mims-harvard/ToolUniverse --skill tooluniverse-sdk -a claude-code
Open on GitHub

What tooluniverse-sdk does

This skill covers programming against the ToolUniverse Python SDK for research work. It lays out three calling patterns: tu.run({"name": ..., "arguments": ...}) as the most portable dict API, tu.tools.ToolName(param=value) for interactive use, and direct class instantiation, which skips caching and hooks.

You must call tu.load_tools() before any tool call, or nothing loads. Tool names are case-sensitive, and Tool_Finder_Keyword returns a nested structure — read the list from tools['tools'] after an isinstance(tools, dict) check. LLM-based tool search needs OPENAI_API_KEY; NCBI_API_KEY is optional. Caching is opt-in per call: tu.tools.some_tool(param="value", use_cache=True). That flag is a framework option, not an argument to ToolUniverse().

Batch work goes through tu.run_batch(calls), and hooks_enabled=True turns on auto-summarization of large outputs. You can load categories selectively with tu.load_tools(categories=["proteins", "drugs"]). One trap in the sample workflow: ChEMBL takes ChEMBL target IDs, not the Ensembl IDs that OpenTargets returns, so map them first, for instance with ChEMBL_search_targets. Worth checking before you wire up a pipeline.

What it helps with

  • build a drug discovery pipeline from disease to compounds
  • call UniProt and ChEMBL tools from one script
  • run a batch of queries over a list of identifiers
  • find a tool by natural-language description
  • wire ToolUniverse into an MCP server

Example prompts for the agent

  • Write a ToolUniverse script that loads tools and finds proteins matching "protein structure"
  • Batch-call UniProt_get_entry_by_accession for a list of accessions with tu.run_batch
  • Show how to cache a deterministic tool call and read the cache stats

How to install tooluniverse-sdk

1Skills CLI (Vercel)

npx skills add mims-harvard/ToolUniverse --skill tooluniverse-sdk -a claude-code

2Manually: put the files in place

~/.claude/skills/tooluniverse-sdk/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/tooluniverse-sdk/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about tooluniverse-sdk

How do I install tooluniverse-sdk in Claude?

Run npx skills add mims-harvard/ToolUniverse --skill tooluniverse-sdk -a claude-code. The skill file then lives at ~/.claude/skills/tooluniverse-sdk/SKILL.md.

What does tooluniverse-sdk do?

It documents the ToolUniverse Python SDK: the three calling patterns, tool loading, batch execution, MCP server integration and embedding-based tool search.

What do I need before using it?

Install the SDK with pip install tooluniverse, and set OPENAI_API_KEY if you want LLM tool search. Always call tu.load_tools() before invoking any tool.

Source text

SKILL.md · Apache-2.0
---
name: tooluniverse-sdk
description: Build AI scientist systems with the ToolUniverse Python SDK for scientific research. Covers the 3 calling patterns (`tu.run` portable dict API, `tu.tools.X` function API, direct class instantiation), tool loading, batch execution, MCP server integration, and embedding-based tool search. Use for SDK programming, custom tool composition, benchmarking pipelines, and integrating ToolUniverse into research workflows.
disable-model-invocation: true
---

# ToolUniverse Python SDK

**3 calling patterns -- start with pattern 1:**
1. `tu.run({"name": ..., "arguments": ...})` -- single tool call, dict API (most portable)
2. `tu.tools.ToolName(param=value)` -- function API (recommended for interactive use)
3. Direct class instantiation -- advanced, bypasses caching/hooks

## Installation

```bash
pip install tooluniverse              # Standard
pip install tooluniverse[embedding]   # Embedding search (GPU)
pip install tooluniverse[all]         # All features
```

```bash
export OPENAI_API_KEY="sk-..."  # Required for LLM tool search
export NCBI_API_KEY="..."       # Optional
```

## Quick Start

```python
from tooluniverse import ToolUniverse

tu = ToolUniverse()
tu.load_tools()  # REQUIRED before any tool call

# Find tools
tools = tu.run({"name": "Tool_Finder_Keyword", "arguments": {"description": "protein structure", "limit": 10}})

# Execute (dict API)
result = tu.run({"name": "UniProt_get_entry_by_accession", "arguments": {"accession": "P05067"}})

# Execute (function API)
result = tu.tools.UniProt_get_entry_by_accession(accession="P05067")
```

## Core Patterns

### Batch Execution

```python
calls = [
    {"name": "UniProt_get_entry_by_accession", "arguments": {"accession": "P05067"}},
    {"name": "UniProt_get_entry_by_accession", "arguments": {"accession": "P12345"}},
]
results = tu.run_batch(calls)
```

### Scientific Workflow

```python
def drug_discovery_pipeline(disease_id):
    tu = ToolUniverse()
    tu.load_tools()
    try:
        targets = tu.tools.OpenTargets_get_associated_targets_by_disease_efoId(efoId=disease_id)
        # ChEMBL takes ChEMBL target IDs, not the Ensembl IDs in `targets`;
        # map them first (e.g. via ChEMBL_search_targets). Example IDs: EGFR, COX-2
        chembl_target_ids = ["CHEMBL203", "CHEMBL230"]
        compound_calls = [
            {"name": "ChEMBL_search_activities",
             "arguments": {"target_chembl_id": tid, "limit": 10}}
            for tid in chembl_target_ids
        ]
        compounds = tu.run_batch(compound_calls)
        return {"targets": targets, "compounds": compounds}
    finally:
        tu.close()
```

## Configuration

```python
# Caching: opt in per call (use_cache is a framework option on tools.X(...),
# not an argument to ToolUniverse() or to the tool itself)
tu = ToolUniverse()
result = tu.tools.some_tool(param="value", use_cache=True)
stats = tu.get_cache_stats()
tu.clear_cache()

# Hooks (auto-summarization of large outputs)
tu = ToolUniverse(hooks_enabled=True)

# Load specific categories
tu.load_tools(categories=["proteins", "drugs"])
```

## Critical Notes

1. **Always call `load_tools()`** before using any tools
2. **Tool Finder returns nested structure**: access via `tools['tools']` after `isinstance(tools, dict)` check
3. **Tool names are case-sensitive**: `UniProt_get_entry_by_accession` not `uniprot_get_...`
4. **Check required params**: `tu.all_tool_dict["ToolName"]['parameter'].get('required', [])`
5. **Cache deterministic calls** (ML predictions, DB queries); don't cache real-time data

## Error Handling

```python
from tooluniverse.exceptions import ToolError, ToolUnavailableError, ToolValidationError

try:
    result = tu.tools.some_tool(param="value")
except ToolUnavailableError:
    ...  # Tool service down
except ToolValidationError as e:
    tool_info = tu.all_tool_dict["some_tool"]
    print(f"Required: {tool_info['parameter'].get('required', [])}")
```

## Tool Categories

| Category | Tools | Use Cases |
|----------|-------|-----------|
| Proteins | UniProt, RCSB PDB, AlphaFold | Protein analysis, structure |
| Drugs | DrugBank, ChEMBL, PubChem | Drug discovery, compounds |
| Genomics | Ensembl, NCBI Gene, gnomAD | Gene analysis, variants |
| Diseases | OpenTargets, ClinVar | Disease-target associations |
| Literature | PubMed, Europe PMC | Literature search |
| ML Models | ADMET-AI, AlphaFold | Predictions, modeling |
| Pathways | KEGG, Reactome | Pathway analysis |

## Resources

- **Docs**: https://zitniklab.hms.harvard.edu/ToolUniverse/
- **GitHub**: https://github.com/mims-harvard/ToolUniverse
- See [REFERENCE.md](REFERENCE.md) for detailed guides.

© mims-harvard · Apache-2.0 · mims-harvard/ToolUniverse

Similar skills

Everything for Science and research →

From the same set56

tooluniverse-statistical-modeling Runs statistical models on biomedical data, including natural splines, logistic regression, power calculations, and clinical trial adverse event severity tests. CX Codex +1 402installs tooluniverse-multi-omics-integration A skill that pulls several omics layers into one analysis: matches samples, runs cross-omics correlations, clusters patients and writes a report. CX Codex +1 398installs tooluniverse-protein-therapeutic-design Guides AI-driven de novo protein design using RFdiffusion and ProteinMPNN. Generates structural backbones, samples sequences, and validates folds before lab experiments. CX Codex +1 398installs tooluniverse-drug-repurposing A skill that hunts for new indications for approved drugs and ranks the candidates by strength of evidence. CX Codex +1 397installs tooluniverse-chemical-safety A skill that assesses chemical and drug toxicity by pulling hazard classifications, ADMET predictions, and gene-disease links into one report. CX Codex +1 396installs tooluniverse-binder-discovery The skill walks an agent through small-molecule discovery for a protein target: druggability assessment, known-ligand mining, similarity expansion, ADMET filtering. CX Codex +1 390installs tooluniverse-metabolomics-analysis End-to-end metabolomics workflow for mass-spec and NMR data. It handles metabolite identification, batch correction, statistical comparisons, and metabolic pathway mapping. CX Codex +1 390installs tooluniverse-gene-enrichment Runs gene-set enrichment analysis using gseapy and clusterProfiler. Useful for interpreting differential gene expression lists without writing ad-hoc scripts. CX Codex +1 388installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor