Scaffold a toolkit with your AI agent
Hand this prompt to your coding agent — Claude Code, Codex, Cursor, whatever you use — and it will scaffold, fill in, validate, and publish a SciToolkit toolkit for you.
Who this is for
Researchers who already work with a coding agent and want a published toolkit without learning the SciToolkit format end-to-end. The agent does the structural work; you steer.
A first toolkit typically takes 15–30 minutes including the parts you do yourself.
What you do yourself
Three things stay in your hands. Everything else is the agent's job.
- Make an account on scitoolkit.org (or sign in).
- Create the toolkit row — choose a name and category. You will receive a one-time publish token. Copy it.
- Paste the publish token to the agent when it asks for one. The agent will use
scitoolkit login --tokenandscitoolkit publishon your behalf.
The prompt
Copy this and paste it into a fresh conversation with your coding agent. The agent will take it from there.
# Build a SciToolkit Toolkit
You are helping a user create and publish a SciToolkit toolkit. SciToolkit is a registry and CLI for scientific AI tools — like PyPI but for tools that AI agents call via MCP. The user has research code they want exposed to agents (Claude Code, Codex) without learning MCP, packaging, or registry mechanics. They know their science; you handle everything else.
---
## What you're building
A directory with a fixed shape:
```
my-toolkit/
├── toolkit.yaml # Metadata + config schema
├── tools/__init__.py # Imports all @define_tool functions
├── tools/*.py # Tool implementations
├── requirements.txt # Python deps (do NOT list orchestral-ai or mcp)
├── README.md # Renders on scitoolkit.org
└── skills/*.md # Optional: agent-facing instructions
```
When `scitoolkit install <name>` runs, this is downloaded into an isolated env. When `scitoolkit serve` runs, tools become callable by any connected MCP agent.
---
## What only the user can do
1. **Sign up** at https://scitoolkit.org.
2. **Create the toolkit row** there (name + category + description) — they'll get a one-time **publish token** starting with `stk_`.
3. **Paste the token to you.** When they do: save to `.env` as `SCITOOLKIT_TOKEN=stk_...`, add `.env` to `.gitignore`, confirm saved, and never echo the token again. You'll use it via `scitoolkit login --token` later.
Walk them through these at the right moment — don't make them do all three upfront.
---
## Install the CLI
```bash
which scitoolkit || pip install scitoolkit
```
Requires Python 3.12+. Orchestral and MCP install automatically as deps.
---
## Defining tools — the core model
Use Orchestral's `@define_tool` decorator (always; not the class form):
```python
from orchestral import define_tool
import json
@define_tool
def search_arxiv(query: str, max_results: int = 10) -> str:
"""Search arXiv for papers matching the query. Returns JSON of results."""
...
return json.dumps(results)
```
Three rules:
- **Type hints on every parameter and return.** They become the JSON schema the agent sees. Without them, agents misuse your tool.
- **Return JSON strings via `json.dumps(...)`.** MCP carries strings.
- **Docstring's first line is the tool's description.** Make it precise — the agent uses it to decide *whether* to call.
### State vs runtime — read carefully
Every input is one of two things:
- **Runtime:** what the agent decides per call (query, IDs, filters, counts). Goes in the signature normally. Agent sees it.
- **State:** true about the deployment, not the call (API keys, paths, DB URLs, secrets). Should be invisible to the agent.
**Rule:** if the value is the same on every call from this user, it's state. If it varies as the agent reasons, it's runtime.
Declare state via `state=[...]`:
```python
@define_tool(state=["api_key"])
def search_arxiv(query: str, max_results: int = 10, *, api_key: str) -> str:
"""Search arXiv."""
response = requests.get(URL, params={"q": query}, headers={"Authorization": f"Bearer {api_key}"})
return json.dumps(response.json())
```
This: hides `api_key` from the agent's MCP schema, marks it for platform injection at serve startup, and tells SciToolkit to require it before serving. Never put API keys in the signature without `state=[...]`.
Stateless tools omit the parameter entirely — most utilities won't have any.
---
## Workflow — drive this top to bottom
1. **Confirm what they want.** Ask the user to describe each tool in plain language: what it does, inputs, outputs, configuration needed. Pin down state vs runtime *before* writing code.
2. **Scaffold:**
```bash
scitoolkit init <name>
```
3. **Write `tools/*.py`** with `@define_tool`. Be explicit about `state=[...]`. Good docstrings.
4. **Fill `toolkit.yaml`:**
```yaml
name: my-toolkit # lowercase-hyphens; match the website registration
version: 0.1.0 # semver, must increase each publish
category: utils # see scitoolkit.org/docs (utils, astro, hep, quantum, bio, chem, materials, neutrino, other)
description: "One-line summary."
author: "Author Name"
license: MIT
homepage: https://github.com/... # optional
keywords: [tag1, tag2] # optional
# One entry per state field declared in tool decorators
config:
- name: api_key
description: "Where to get this key: ..."
type: secret # or: string, path, choice
required: true
# Companion toolkits the agent will likely use alongside this one (no runtime coupling)
expected_toolkits:
- arxiv-search
environment:
python: "3.12" # only if you need a specific version
```
5. **Update `tools/__init__.py`** to export every decorated function:
```python
from .search import search_arxiv
__all__ = ["search_arxiv"]
```
6. **Write `requirements.txt`** — concrete deps, pin versions when stability matters. Skip `orchestral-ai` and `mcp` (auto-installed).
7. **Write `README.md`** — what it does, tools it provides, config required, example queries.
8. **Optional `skills/*.md`** — agent-facing usage notes. Frontmatter format:
```markdown
---
name: my-toolkit
description: Use when the user wants to <specific scenario>.
---
Body: how to use the tools, edge cases, best practices.
```
Auto-installed to `~/.claude/skills/<toolkit>/` so Claude Code picks them up.
9. **Validate:**
```bash
scitoolkit validate
```
Fix everything it reports. Don't skip.
10. **Have the user create the toolkit row on scitoolkit.org** (if not done) and paste you the token. Save it as described above.
11. **Login and publish:**
```bash
scitoolkit login --token "$SCITOOLKIT_TOKEN"
scitoolkit publish
```
12. **Verify** at https://scitoolkit.org/toolkit/<name>. Suggest local test:
```bash
scitoolkit install <name> && scitoolkit serve
```
---
## Common errors
- **"version already exists":** bump `version:` in `toolkit.yaml`. Must be monotonically increasing semver.
- **"invalid category":** check the live list at scitoolkit.org/docs.
- **Wrong tool schema (params missing/typed wrong):** add type hints; revalidate; republish.
- **State value not injected:** the field name in `config:` must exactly match the name in `state=[...]`, and the user must have filled it in (prompt at install, or `~/.scitoolkit/config/<toolkit>.yaml`).
- **Toolkit needs Python ≠ 3.12:** set `environment.python:`. Platform uses conda; refuses cleanly if conda missing.
- **Toolkit needs Docker / GPU / system libs:** Docker mode is Phase 3B, not yet supported. Tell the user to wait.
---
## Style rules
- **No emojis** in code, output, or yaml. Hard rule.
- **Keep docstrings tight and specific.** The agent reads them to decide *if* to call.
- **Treat anything that looks like a secret as a secret.** Save to `.env`, never echo.
- **Init a git repo** in the toolkit dir if not already; commit as you go.
---
## Reference
- Full docs: https://scitoolkit.org/docs/authoring
- Stateful tools: https://scitoolkit.org/docs/stateful-tools
- Recipes: https://scitoolkit.org/docs/recipes
- CLI help: `scitoolkit --help`, `scitoolkit <cmd> --help`
Ask what the user wants to build, then build it.
markdownWhat to expect
After you hand over the prompt, your agent will:
- Scaffold the toolkit directory with
scitoolkit init. - Ask you about the tools you want — what they do, what they take as input, what they return.
- Write the Python tool definitions, the
toolkit.yamlmetadata, theREADME.md, and any skills. - Run
scitoolkit validateand fix anything that comes up. - Ask you for the publish token, then run
scitoolkit login --tokenandscitoolkit publish.
Your toolkit appears in the registry immediately and is ready to install.
Prefer the manual path?
If you'd rather drive every step yourself, the Authoring Guide covers the same material at human pace.