# CLI reference

> Every command of vukem-tools, its flags, its output and its exit codes.

Source: https://tools.vukem.dev/docs/reference/cli/

`vukem-tools` runs the tools of Vukem Tools from a terminal. It converts nothing itself: it uploads your files to a server through the [HTTP API](/docs/api/overview), waits, and downloads the result. It is the same program as the [MCP server](/docs/mcp/overview), and it reads the same table of tools.

## Setup

| Variable | Default | Meaning |
| --- | --- | --- |
| `VUKEM_TOOLS_URL` | `http://localhost:3000` | The Vukem Tools server. |
| `VUKEM_TOOLS_API_KEY` | none | An API key that may run the tool. See [Authentication](/docs/api/overview#authentication). |

## Commands

| Command | What it does |
| --- | --- |
| `vukem-tools <area> <tool> [flags]` | Runs a tool. For example `vukem-tools pdf crop`. |
| `vukem-tools run <tool> [flags]` | The same, by the tool's name, for example `run pdf-crop`. |
| `vukem-tools <area>` | Lists the tools of an area, with a summary of each. |
| `vukem-tools tools` | Prints every tool as JSON: `{"tools": [...]}`. |
| `vukem-tools mcp` | Serves every tool over MCP on standard input and output. See [Connect](/docs/mcp/connect). |
| `vukem-tools serve [--addr host:port]` | Serves MCP over local HTTP. Default `127.0.0.1:8787`. See [Protocol](/docs/mcp/connect#local-http). |
| `vukem-tools version` | Prints the version. Also `--version`. |
| `vukem-tools help` | Prints the usage. Also `--help` and `-h`. |

The areas are `archive`, `audio`, `image`, `office`, `pdf`, `sprite` and `video`. Run `vukem-tools pdf` to see the 20 PDF commands, or [Tools](/docs/mcp/tools) for all 37, each with its CLI command.

## Run a tool

```bash
vukem-tools pdf crop --input in.pdf --output out.pdf --left 36 --right 36
```

Every tool has these flags:

| Flag | Meaning |
| --- | --- |
| `--input FILE` | The file to read. Repeat it for a tool that takes several files, in the order the tool uses them. |
| `--output PATH` | Where to write the result. A file, or a directory for a tool that makes several files. Required. |
| `--options JSON` | The tool's options as a JSON object, for what the flags cannot express. |
| `--json` | Print the result as JSON. |
| `--timeout DURATION` | How long to wait for the conversion. Default `10m`. |
| `--idempotency-key KEY` | Make a retry return the same conversion. |
| `--help` | Show the tool's description, how many files it reads and every flag. |

Each scalar option of a tool, and each list of strings, is also a flag of its own. The name is the option's name with underscores turned into hyphens, so the option `owner_password` of `pdf-protect` is `--owner-password`. Repeat a list flag for several values. An option that is an object or a list of objects goes through `--options`. A flag you set wins over the same key in `--options`. `vukem-tools <area> <tool> --help` lists what a tool accepts, and [Tools](/docs/mcp/tools) lists it with types and limits.

A tool takes no loose arguments: write `--input in.pdf`, not `in.pdf`.

## Output

Without `--json`, the command prints one line for each file written, then the note the conversion has, if any:

```text
out.pdf (1234 bytes)
```

With `--json` it prints one JSON object. See the shape in [Protocol](/docs/mcp/overview#what-a-result-looks-like).

## Errors and exit codes

An error goes to standard error. With `--json` it is a JSON object with a stable `code`; without it, `error: <code>: <message>`. The codes are the ones in [Protocol](/docs/mcp/overview#what-a-result-looks-like).

| Exit code | When |
| --- | --- |
| `0` | It worked. |
| `1` | The call failed: no key, a refused key, a network error, a failed conversion, a timeout. |
| `2` | The command was wrong: an unknown command or tool, a bad flag, an argument out of range, or a browser tool, which has no command. |

## Browser tools

Seventeen tools run in the browser on the site and have no command: `base64`, `data-convert`, `diff`, `hash`, `json-format`, `json-schema`, `jwt-decode`, `password`, `uuid`, `cep-lookup`, `cnpj-lookup`, `cpf-cnpj`, `fake-person`, `chat-template`, `llm-clean`, `llm-cost` and `token-count`. `vukem-tools run <name>` for one of them exits with `2` and the code `browser_only`.

## Next step

Use the same tools from an agent: [MCP overview](/docs/mcp/overview).
