# Tool.command
URL: https://lsd.tools/docs/api-tool-command
Updated: 2026-07-17

## Parameters

| name | type | default | description |
|---|---|---|---|
| `name` | `str` | — | the sub-command name, invoked as `lsd <tool> <name>` |
| `help` | `str` | `""` | one-line help text shown in `lsd <tool> --help` |

## Example

```python
@tool.command("count", help="Count rows in a file")
def count(ctx, path: str) -> None:
    print(len(Source.file(path).read()))
```

## Notes

The function is `(ctx, ...)`; its typed parameters become CLI options — no default → required
positional/option, with default → optional. There is no argparse to write. The command is surfaced
when the tool is mounted into a CLI host.

## See also

**API:** [action](/docs/api-tool-action) · [dispatch](/docs/api-tool-dispatch) · [Context](/docs/api-context)

**Guides:** [Commands & actions](/docs/tools-commands-actions) · [A CLI command](/docs/ex-cli-command)
