Skip to main content
The run command executes a TypeScript script in the Toolshed runtime with your role’s full tool catalog available. You can pass a path to a .ts file or provide an inline TypeScript expression. The command loads your credentials and role from the Toolshed server, sets up the runtime, runs the script, and prints the result as JSON.

Usage

toolshed run <script>
<script> is either a path to a TypeScript file or a string of TypeScript code.

Examples

toolshed run ./my-script.ts
The output is the return value of the script, printed as formatted JSON:
{
  "issues": [
    { "number": 42, "title": "Fix login bug" }
  ]
}

How it works

When you run toolshed run:
  1. The CLI reads your session token from ~/.toolshed/config.json and the server URL from TOOLSHED_SERVER
  2. It fetches your role and the available tool catalog from the Toolshed server
  3. It creates a runtime instance scoped to your role’s authorized tools
  4. It executes the script, routing any tool calls through the runtime
  5. It prints the result and disposes the runtime
Run toolshed login before using toolshed run so the CLI can authenticate against the server and fetch your tool catalog.

Environment variables

Common

VariableDescriptionDefault
TOOLSHED_SERVERURL of the Toolshed serverhttp://localhost:3000
TOOLSHED_RUNTIMEExecution runtime: local or vercellocal

Vercel runtime

When TOOLSHED_RUNTIME=vercel, the following variables are required:
VariableDescription
VERCEL_TEAM_IDYour Vercel team ID
VERCEL_PROJECT_IDThe Vercel project ID for the sandboxed runtime
VERCEL_TOKENA Vercel API token with deployment access
TOOLSHED_SNAPSHOT_ID(Optional) Snapshot ID to pin the runtime version
TOOLSHED_RUNTIME=vercel \
VERCEL_TEAM_ID=team_xxxx \
VERCEL_PROJECT_ID=prj_xxxx \
VERCEL_TOKEN=your_token \
toolshed run ./my-script.ts
Scripts run with full access to your role’s authorized tools. Review scripts carefully before executing them, especially those that call destructive or write-capable tools.