Skill (en)

# List consumer categories

## What this tool does

Lists the loyalty customer categories available for the target organization's configured iiko client.

## Inputs

- one client: `--client <slug>`
- several clients: `--clients <slug_one,slug_two>`
- all configured clients: `--all-clients`
- optional organization override: `--organization-id <id>`
- optional all-organizations mode: `--all-organizations`
- optional JSON output: `--json`
- optional config source: `--use-local-env` / `--no-use-local-env` (MCP: `use_local_env`); default follows `IIKO_DEFAULT_USE_LOCAL_ENV`

## Output

- default output is Markdown
- JSON output is available with `--json`
- each result includes the client slug, client name, and the returned consumer categories
- without `--all-organizations`, the command uses the first discovered organization by default

## Shared pieces used

- `IikoSettings`, `get_client_settings`, `get_client_settings_many`
- `get_access_token()`
- `resolve_organization_ids()`
- `get_customer_categories()`
- `IikoTransport`

## Testing instructions

- run the focused tests:
  - `.venv/bin/python -m pytest tests/shared/test_customer_categories.py tests/commands/test_list_consumer_categories.py -q`
- smoke-test the CLI manually:
  - `.venv/bin/python -m iiko_api_mcp_server.commands.list_consumer_categories --client client_one --organization-id replace-with-organization-id`
  - `.venv/bin/python -m iiko_api_mcp_server.commands.list_consumer_categories --client client_one --all-organizations`
  - `.venv/bin/python -m iiko_api_mcp_server.commands.list_consumer_categories --all-clients --json`

## Testing quality

- unit tests cover the shared endpoint helper, normalized command output, Markdown rendering, and the CLI entrypoint
- tests also cover the default-first organization behavior and the opt-in `--all-organizations` path
- residual risk: live organizations can expose category names and flags not represented in the current fixtures, but the parsing surface is intentionally small