CLI Reference

The tpm command-line interface for searching, executing, and managing AI tools from your terminal.

Installation

Get started with the TPMJS CLI

npm install -g @tpmjs/cli

This installs the tpm command globally. Requires Node.js 18 or later.

Verify your installation:

tpm --version

Quick Start

Common workflows to get up and running

# Authenticate
tpm auth login

# Search for tools
tpm tool search firecrawl

# Show trending tools
tpm tool trending

# Get tool info
tpm tool info @tpmjs/official-firecrawl scrapeTool

# Execute a tool
tpm tool execute firecrawl-scrape --input '{"url":"https://example.com"}'

# Generate MCP config for your AI client
tpm mcp config ajax/my-collection

Authentication

Login and manage your credentials

CommandDescription
tpm auth loginLogin with API key or browser OAuth
tpm auth logoutLog out and clear credentials
tpm auth statusShow authentication status
tpm auth whoamiShow current user info

Login Methods

# Interactive browser OAuth
tpm auth login

# Direct API key
tpm auth login --api-key YOUR_API_KEY

You can also set the TPMJS_API_KEY environment variable to authenticate without logging in.

Tools

Search, discover, execute, and create tools

Search & Discovery

CommandDescription
tpm tool search [query]Search for tools in the registry
tpm tool trendingShow trending tools
tpm tool info <package> <tool>Get detailed tool information
# Search by name
tpm tool search firecrawl

# Show more trending results
tpm tool trending --limit 20

# Get detailed info about a specific tool
tpm tool info @tpmjs/official-firecrawl scrapeTool

Execute Tools

Run tools directly from the registry with JSON input:

FlagDescription
--input, -iInput parameters as JSON string
--input-file, -fPath to JSON file with input
--stream, -sStream output
--timeout, -tTimeout in seconds (default: 300)
# Execute with inline JSON
tpm tool execute firecrawl-scrape --input '{"url":"https://example.com"}'

# Execute with input from file
tpm tool execute my-tool --input-file params.json

# Stream results
tpm tool execute my-tool --stream

Create & Validate

# Initialize a new tool package (interactive)
tpm tool init

# Initialize with a name and template
tpm tool init my-tool --template rich

# Validate local tpmjs config in package.json
tpm tool validate

Available categories: research, web, data, documentation, engineering, security, statistics, ops, agent, sandbox, utilities, html, compliance.

Agents

Create and interact with AI agents

CommandDescription
tpm agent listList your agents
tpm agent createCreate a new agent
tpm agent update <id>Update an agent
tpm agent delete <id>Delete an agent
tpm agent chat <id>Interactive chat with an agent
# Interactive chat session
tpm agent chat <agent-id>

# Send a single message
tpm agent chat <agent-id> "What tools can help with web scraping?"

Collections

Organize and share groups of tools

Manage Collections

CommandDescription
tpm collection listList your collections
tpm collection createCreate a new collection
tpm collection info <user/slug>Show collection details and tools
tpm collection update <id>Update collection metadata
tpm collection delete <id>Delete a collection

Manage Tools in Collections

# Add tools by ID
tpm collection add my-collection tool-id-1 tool-id-2

# Add tools from an npm package
tpm collection add my-collection --package @org/my-tools

# Search for tools and add them in one step
tpm collection add my-collection --search "firecrawl"
tpm collection add my-collection --search "web scraper" --category web --limit 3

# Remove a tool
tpm collection remove my-collection tool-id

# Import from file (IDs, one per line or JSON array)
tpm collection import my-collection --file tools.txt

# Update metadata
tpm collection update my-col --name "New Name" --public
tpm collection update my-col --no-public  # Make private

Run Tools via MCP

Execute tools from collections using the MCP protocol

The tpm run command executes a tool from a collection via the MCP API:

# Basic usage
tpm run -c ajax/unsandbox -t execute --args '{"code":"print(1)","language":"python"}'

# With environment variables
tpm run -c ajax/my-collection -t myTool --env API_KEY=xxx --env DEBUG=true

# Using process environment
OPENAI_API_KEY=xxx tpm run -c ajax/ai-tools -t generate

# JSON output for scripting
tpm run -c ajax/tools -t base64Encode --args '{"data":"hello"}' --json | jq .result

Scenarios

Test collections with AI-powered scenario testing

CommandDescription
tpm scenario list [collection]List scenarios (all public, or for a collection)
tpm scenario info <id>Show scenario details and recent runs
tpm scenario generate <collection>Generate AI-powered test scenarios
tpm scenario run <collection>Run all scenarios for a collection
tpm scenario test <id>Run a single scenario
# Generate 3 test scenarios for a collection
tpm scenario generate my-collection --count 3

# Run all scenarios and see pass rates
tpm scenario run my-collection

# Test a specific scenario
tpm scenario test clu123abc456 --verbose

MCP Integration

Connect collections to AI clients via Model Context Protocol

Generate MCP configuration for popular AI clients, or run the CLI as a local MCP server.

# Auto-detect client
tpm mcp config ajax/my-collection

# For specific clients
tpm mcp config ajax/my-col --client claude     # Claude Desktop
tpm mcp config ajax/my-col --client cursor     # Cursor
tpm mcp config ajax/my-col --client windsurf   # Windsurf

# Run as local MCP server
tpm mcp serve                                  # HTTP on port 3333
tpm mcp serve --stdio                          # stdio mode

See the MCP Collections docs for more on connecting clients.

Publishing

Check and preview your tools before publishing

# Check if your package has been discovered on tpmjs.com
tpm publish check @myorg/my-tool
tpm publish check              # Check current directory's package

# Preview how your tool will appear
tpm publish preview
tpm publish preview --path ./my-tool

Tools are discovered automatically from npm. Add the tpmjs keyword to your package.json to be indexed. See the Publishing Guide for details.

Utilities

Diagnostics, playground, and updates

CommandDescription
tpm doctorRun diagnostic checks (Node.js, config, auth, API, disk)
tpm playgroundInteractive tool testing REPL
tpm updateUpdate CLI to latest version
# Run diagnostics
tpm doctor --verbose

# Open the interactive playground
tpm playground
tpm playground --web   # Open web version
tpm playground --tool firecrawl-scrape   # Start with a specific tool

Global Flags

Available on all commands

FlagDescription
--jsonOutput in JSON format (for scripting)
--verbose, -vShow detailed/debug output
--helpShow command help
--versionShow CLI version
# JSON output for scripting
tpm tool search firecrawl --json | jq '.data[0].name'

# Verbose mode for debugging
tpm doctor --verbose

Configuration

Config files and environment variables

Configuration is stored in ~/.tpmjs/config.json:

{
  "apiUrl": "https://tpmjs.com/api",
  "defaultOutput": "human",
  "verbose": false,
  "analytics": false
}

Credentials are stored securely in ~/.tpmjs/credentials.json with restricted file permissions (0600).

Environment Variables

VariableDescription
TPMJS_API_KEYAPI key for authentication
TPMJS_API_URLCustom API URL (default: https://tpmjs.com/api)

Programmatic Usage

Use the CLI as a library in Node.js

The CLI also exports a client library for programmatic use:

import { TpmClient } from '@tpmjs/cli';

const client = new TpmClient({ apiKey: 'your-key' });
const tools = await client.searchTools('firecrawl');

Next Steps