# Tools

## Auth Tools

### `set_user_context`

Set the user context for subsequent operations.

| Parameter | Type   | Required | Description                                                |
| --------- | ------ | -------- | ---------------------------------------------------------- |
| `userId`  | string | No\*     | User ID to set                                             |
| `apiKey`  | string | No\*     | API key (`tb_` format) — userId is extracted automatically |

\*One of `userId` or `apiKey` is required.

### `get_user_context`

Get the current user context. No parameters.

## Exchange Tools

### `list_exchanges`

List all exchange accounts. No parameters.

### `get_exchange`

| Parameter | Type   | Required | Description         |
| --------- | ------ | -------- | ------------------- |
| `id`      | string | Yes      | Exchange account ID |

### `test_exchange`

Test exchange API credentials.

| Parameter       | Type   | Required | Description                      |
| --------------- | ------ | -------- | -------------------------------- |
| `exchange_name` | string | Yes      | Exchange name (e.g., "binance")  |
| `api_key`       | string | Yes      | Exchange API key                 |
| `api_secret`    | string | Yes      | Exchange API secret              |
| `trading_type`  | string | No       | "spot", "margin", or "perpetual" |

### `create_exchange`

Add a new exchange account.

### `delete_exchange`

| Parameter | Type   | Required | Description         |
| --------- | ------ | -------- | ------------------- |
| `id`      | string | Yes      | Exchange account ID |

### `list_supported_exchanges`

List all supported exchanges. No parameters.

## Strategy Tools

### `list_strategies`

List all strategies. No parameters.

### `get_strategy`

| Parameter | Type   | Required | Description |
| --------- | ------ | -------- | ----------- |
| `id`      | string | Yes      | Strategy ID |

### `create_strategy`

| Parameter           | Type   | Required | Description                   |
| ------------------- | ------ | -------- | ----------------------------- |
| `exchangeAccountId` | string | Yes      | Exchange account ID           |
| `name`              | string | Yes      | Strategy name (max 100 chars) |
| `description`       | string | No       | Strategy description          |

### `update_strategy`

Update strategy settings.

### `delete_strategy`

| Parameter | Type   | Required | Description |
| --------- | ------ | -------- | ----------- |
| `id`      | string | Yes      | Strategy ID |

### `link_copiers`

Link copiers to a strategy.

## Copier Tools

### `list_copiers`

List all copiers. No parameters.

### `get_copier`

| Parameter | Type   | Required | Description |
| --------- | ------ | -------- | ----------- |
| `id`      | string | Yes      | Copier ID   |

### `create_copier`

| Parameter           | Type   | Required | Description                 |
| ------------------- | ------ | -------- | --------------------------- |
| `exchangeAccountId` | string | Yes      | Exchange account ID         |
| `name`              | string | Yes      | Copier name (max 100 chars) |
| `strategyId`        | string | No       | Strategy ID to copy from    |

### `update_copier`

Update copier settings.

### `delete_copier`

| Parameter | Type   | Required | Description |
| --------- | ------ | -------- | ----------- |
| `id`      | string | Yes      | Copier ID   |

### `toggle_copier_status`

Start or stop a copier.

| Parameter | Type   | Required | Description |
| --------- | ------ | -------- | ----------- |
| `id`      | string | Yes      | Copier ID   |

## Trade Tools

### `list_trades`

| Parameter           | Type   | Required | Description                                                    |
| ------------------- | ------ | -------- | -------------------------------------------------------------- |
| `strategyId`        | string | No       | Filter by strategy                                             |
| `exchangeAccountId` | string | No       | Filter by exchange account                                     |
| `status`            | string | No       | `PENDING`, `FILLED`, `PARTIALLY_FILLED`, `CANCELLED`, `FAILED` |
| `side`              | string | No       | `BUY` or `SELL`                                                |
| `limit`             | number | No       | Max results (1-100, default 50)                                |
| `offset`            | number | No       | Pagination offset                                              |

### `get_trade`

| Parameter | Type   | Required | Description |
| --------- | ------ | -------- | ----------- |
| `id`      | string | Yes      | Trade ID    |

### `get_trade_analytics`

| Parameter    | Type   | Required | Description              |
| ------------ | ------ | -------- | ------------------------ |
| `strategyId` | string | No       | Strategy ID to filter by |

### `cancel_trade`

| Parameter | Type   | Required | Description |
| --------- | ------ | -------- | ----------- |
| `id`      | string | Yes      | Trade ID    |
