> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decibel.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool Reference

> Complete reference for all Decibel MCP server tools

The Decibel MCP server exposes 25 tools. Each tool accepts a JSON input validated with Zod schemas and returns JSON results.

## Trading tools

### `place_limit_order`

Place a limit order on Decibel DEX. Returns order ID and transaction hash on success.

| Parameter       | Type    | Required | Description                            |
| --------------- | ------- | -------- | -------------------------------------- |
| `side`          | string  | Yes      | `buy`, `sell`, `long`, or `short`      |
| `size`          | number  | Yes      | Order size (quantity)                  |
| `symbol`        | string  | Yes      | Market symbol (e.g., `BTC/USD`)        |
| `price`         | number  | Yes      | Limit price                            |
| `timeInForce`   | string  | No       | `gtc` (default), `post-only`, or `ioc` |
| `reduceOnly`    | boolean | No       | Reduce-only order (default: `false`)   |
| `clientOrderId` | string  | No       | Client order ID for tracking           |

### `place_market_order`

Place a market order. Executes immediately at current price with slippage tolerance.

| Parameter       | Type    | Required | Description                          |
| --------------- | ------- | -------- | ------------------------------------ |
| `side`          | string  | Yes      | `buy`, `sell`, `long`, or `short`    |
| `size`          | number  | Yes      | Order size                           |
| `symbol`        | string  | Yes      | Market symbol                        |
| `slippage`      | number  | No       | Slippage percentage (default: `1`)   |
| `reduceOnly`    | boolean | No       | Reduce-only order (default: `false`) |
| `clientOrderId` | string  | No       | Client order ID for tracking         |

### `place_stop_limit_order`

Place a stop limit order. Triggers when the market reaches the stop price, then posts as a limit order at the specified price.

| Parameter       | Type    | Required | Description                                 |
| --------------- | ------- | -------- | ------------------------------------------- |
| `side`          | string  | Yes      | `buy`, `sell`, `long`, or `short`           |
| `size`          | number  | Yes      | Order size                                  |
| `symbol`        | string  | Yes      | Market symbol                               |
| `price`         | number  | Yes      | Limit price (execution price after trigger) |
| `stopPrice`     | number  | Yes      | Stop trigger price                          |
| `timeInForce`   | string  | No       | `gtc` (default), `post-only`, or `ioc`      |
| `reduceOnly`    | boolean | No       | Reduce-only order (default: `false`)        |
| `clientOrderId` | string  | No       | Client order ID for tracking                |

### `place_stop_market_order`

Place a stop market order. Triggers when the market reaches the stop price, then executes immediately with slippage tolerance.

| Parameter       | Type    | Required | Description                                        |
| --------------- | ------- | -------- | -------------------------------------------------- |
| `side`          | string  | Yes      | `buy`, `sell`, `long`, or `short`                  |
| `size`          | number  | Yes      | Order size                                         |
| `symbol`        | string  | Yes      | Market symbol                                      |
| `stopPrice`     | number  | Yes      | Stop trigger price                                 |
| `slippage`      | number  | No       | Slippage percentage from stop price (default: `1`) |
| `reduceOnly`    | boolean | No       | Reduce-only order (default: `false`)               |
| `clientOrderId` | string  | No       | Client order ID for tracking                       |

### `place_twap_order`

Place a TWAP (Time-Weighted Average Price) order. Splits execution across a duration at regular intervals.

| Parameter       | Type    | Required | Description                                      |
| --------------- | ------- | -------- | ------------------------------------------------ |
| `side`          | string  | Yes      | `buy`, `sell`, `long`, or `short`                |
| `size`          | number  | Yes      | Total order size                                 |
| `symbol`        | string  | Yes      | Market symbol                                    |
| `duration`      | number  | Yes      | Total duration in seconds (min: 120, max: 86400) |
| `frequency`     | number  | Yes      | Execution frequency in seconds (min: 60)         |
| `reduceOnly`    | boolean | No       | Reduce-only order (default: `false`)             |
| `clientOrderId` | string  | No       | Client order ID for tracking                     |

***

## Order management tools

### `close_position`

Close an open position. Places a reduce-only market order in the opposite direction. Supports partial closes.

| Parameter  | Type   | Required | Description                                 |
| ---------- | ------ | -------- | ------------------------------------------- |
| `symbol`   | string | Yes      | Market symbol                               |
| `slippage` | number | No       | Slippage percentage (default: `1`)          |
| `size`     | number | No       | Partial close size (omit for full position) |

### `cancel_order`

Cancel an open order by order ID.

| Parameter | Type   | Required | Description   |
| --------- | ------ | -------- | ------------- |
| `orderId` | string | Yes      | Order ID      |
| `symbol`  | string | Yes      | Market symbol |

### `cancel_all_orders`

Cancel all open orders. Optionally filter by market.

| Parameter | Type   | Required | Description                                      |
| --------- | ------ | -------- | ------------------------------------------------ |
| `symbol`  | string | No       | Market symbol to filter (cancels all if omitted) |

### `cancel_twap_order`

Cancel an active TWAP order by order ID.

| Parameter | Type   | Required | Description   |
| --------- | ------ | -------- | ------------- |
| `orderId` | string | Yes      | TWAP order ID |
| `symbol`  | string | Yes      | Market symbol |

### `place_tp_sl`

Set take-profit and/or stop-loss for an existing position. Omit size fields to apply to the full position.

| Parameter        | Type   | Required | Description                               |
| ---------------- | ------ | -------- | ----------------------------------------- |
| `symbol`         | string | Yes      | Market symbol                             |
| `tpTriggerPrice` | number | No       | Take-profit trigger price                 |
| `tpLimitPrice`   | number | No       | Take-profit limit price (execution price) |
| `tpSize`         | number | No       | Take-profit size (omit for full position) |
| `slTriggerPrice` | number | No       | Stop-loss trigger price                   |
| `slLimitPrice`   | number | No       | Stop-loss limit price (execution price)   |
| `slSize`         | number | No       | Stop-loss size (omit for full position)   |

### `cancel_tp_sl`

Cancel a TP/SL order for a position.

| Parameter | Type   | Required | Description    |
| --------- | ------ | -------- | -------------- |
| `orderId` | string | Yes      | TP/SL order ID |
| `symbol`  | string | Yes      | Market symbol  |

***

## Account query tools

### `get_positions`

Get all open positions for the account. No parameters required.

### `get_orders`

Get all open orders for the account. No parameters required.

### `get_balances`

Get account balances including wallet USDC, trading account value, and margin info. No parameters required.

### `get_active_twaps`

Get all active TWAP orders for the account. No parameters required.

### `get_trade_history`

Get recent trade fill history.

| Parameter | Type   | Required | Description                                        |
| --------- | ------ | -------- | -------------------------------------------------- |
| `limit`   | number | No       | Number of trades to return (default: 20, max: 100) |

### `get_order_history`

Get order history for the account (all states including filled, cancelled, etc.).

| Parameter | Type   | Required | Description                                        |
| --------- | ------ | -------- | -------------------------------------------------- |
| `limit`   | number | No       | Number of orders to return (default: 20, max: 200) |

### `get_twap_history`

Get TWAP order history (completed and cancelled TWAPs).

| Parameter | Type   | Required | Description                                             |
| --------- | ------ | -------- | ------------------------------------------------------- |
| `limit`   | number | No       | Number of TWAP orders to return (default: 20, max: 200) |

### `get_funding_history`

Get funding rate payment history.

| Parameter | Type   | Required | Description                                         |
| --------- | ------ | -------- | --------------------------------------------------- |
| `limit`   | number | No       | Number of records to return (default: 20, max: 200) |

### `get_tp_sl`

Get all TP/SL orders for a market position, including position-level and fixed-size TP/SL orders.

| Parameter | Type   | Required | Description   |
| --------- | ------ | -------- | ------------- |
| `symbol`  | string | Yes      | Market symbol |

***

## Market data tools

### `get_markets`

List all available markets on Decibel DEX with their configurations. No parameters required.

### `get_price`

Get current price, funding rate, and open interest for a market.

| Parameter | Type   | Required | Description   |
| --------- | ------ | -------- | ------------- |
| `symbol`  | string | Yes      | Market symbol |

### `get_orderbook`

Get the order book (bids and asks) for a market.

| Parameter | Type   | Required | Description                                   |
| --------- | ------ | -------- | --------------------------------------------- |
| `symbol`  | string | Yes      | Market symbol                                 |
| `depth`   | number | No       | Number of price levels (default: 10, max: 20) |

***

## Configuration tools

### `set_leverage`

Set leverage for a market.

| Parameter    | Type   | Required | Description                     |
| ------------ | ------ | -------- | ------------------------------- |
| `symbol`     | string | Yes      | Market symbol                   |
| `leverage`   | number | Yes      | Leverage value (1-100)          |
| `marginType` | string | No       | `cross` (default) or `isolated` |

### `set_margin_type`

Switch margin type for a market between cross and isolated. Preserves current leverage.

| Parameter    | Type   | Required | Description           |
| ------------ | ------ | -------- | --------------------- |
| `symbol`     | string | Yes      | Market symbol         |
| `marginType` | string | Yes      | `cross` or `isolated` |
