# Commands

`mapbox commands` is how to find the command for a task without reading every page of this reference — a coding agent especially, which can search by what it wants to do and then run the top match. Both commands read the same command tree `mapbox --schema` describes, so they cover every command this build has. Both are local: no request and no token. `-o json` gives each command as `{command, summary}`; for the full machine-readable description of a command's arguments and the request it makes, run `mapbox <command> --schema`, or `mapbox --schema` for the whole CLI (see [`--schema`](https://docs.mapbox.com/ja/cli/reference/global-options/)).

-   [`mapbox commands search`](#mapbox-commands-search)
-   [`mapbox commands list`](#mapbox-commands-list)

## `mapbox commands search`

Lists the commands that match a task, closest first. It's keyword matching, not a model: each word of the query is matched against a command's name, summary, description and argument help, with the name counting most. A word can be a prefix (`geo`), another ending of the same stem (`geocoding` for `geocoder`) or one typo away (`uplaod`), and a few common words stand in for the ones commands use ("remove" for "delete"). Words like "how", "my", "to" and "mapbox" are ignored.

Name the action and the thing acted on — "upload a font", not "get my typeface onto Mapbox". A task no command does usually still returns a few weak guesses, so check the summaries before running one. No match isn't an error: text output says so on stderr, JSON prints `[]`, and both exit 0. A query with no words at all is a usage error (exit 2).

Under `-o json`, each match also has a `score` from 0 to 1: how much of the query the command's own text covers. It isn't a confidence, so don't use it as a cutoff.

**Parameters:**

| Parameter | Description |
| --- | --- |
| `<query>...` | What you want to do, in a few words. Quoted or not. |
| `--limit` | How many matches to show. Defaults to `5`; `0` shows every match. |

**Examples:**

```sh
mapbox commands search upload a font
mapbox commands search "snap a gps trace to roads"
mapbox commands search tiles --limit 0
mapbox commands search "upload a font" -o json
```

## `mapbox commands list`

Lists every command with its summary, sorted by name.

**Examples:**

```sh
mapbox commands list
mapbox commands list -o json
```