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

# Tool reference

> Current tools available in the Phantom MCP Server with parameters, types, and examples

<Info>
  Before using any tool, call `get_connection_status` or `get_wallet_addresses` to confirm the wallet is authenticated.
</Info>

<Warning>
  `send_solana_transaction`, `send_evm_transaction`, and `transfer_tokens` use a simulation-first flow by default. Omit `confirmed` on the first call to preview the action, then pass `confirmed: true` only after the user approves the simulation.
</Warning>

## Wallet operations

### get\_connection\_status

Lightweight check of the local wallet connection status. Use this before any operation to confirm authentication without fetching full wallet details.

No parameters.

### get\_wallet\_addresses

Gets all blockchain addresses for the authenticated embedded wallet (Solana, Ethereum, Bitcoin, Sui).

| Parameter         | Type   | Required | Description                                       |
| ----------------- | ------ | -------- | ------------------------------------------------- |
| `derivationIndex` | number | No       | Derivation index for the addresses (default: `0`) |

Example response:

```json theme={null}
{
  "walletId": "05307b6d-2d5a-43d6-8d11-08db650a169b",
  "addresses": [
    { "addressType": "Solana", "address": "H8FpYTgx4Uy9aF9Nk9fCTqKKFLYQ9KfC6UJhMkMDzCBh" },
    { "addressType": "Ethereum", "address": "0x8d8b06e017944f5951418b1182d119a376efb39d" },
    { "addressType": "BitcoinSegwit", "address": "bc1qkce5fvaxe759yu5xle5axlh8c7durjsx2wfhr9" },
    { "addressType": "Sui", "address": "0x039039cf69a336cb84e4c1dbcb3fa0c3f133d11b8146c6f7ed0d9f6817529a62" }
  ]
}
```

### get\_token\_balances

Returns token holdings for the authenticated wallet with live USD pricing via the Phantom portfolio API.

| Parameter         | Type      | Required | Description                                                                                                                                                                |
| ----------------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `networks`        | string\[] | No       | Filter by network names (e.g., `["solana", "ethereum", "base", "polygon", "arbitrum", "bitcoin", "sui", "monad"]`). Omit to return balances across all supported networks. |
| `derivationIndex` | number    | No       | Derivation index for the account (default: `0`)                                                                                                                            |

### send\_solana\_transaction

Simulates, signs, and broadcasts a Solana transaction.

| Parameter         | Type    | Required | Description                                                                       |
| ----------------- | ------- | -------- | --------------------------------------------------------------------------------- |
| `transaction`     | string  | Yes      | Base64-encoded transaction (standard base64 with `A-Za-z0-9+/=`)                  |
| `networkId`       | string  | No       | Solana network identifier (e.g., `solana:mainnet`). Defaults to `solana:mainnet`. |
| `derivationIndex` | number  | No       | Derivation index for the account (default: `0`)                                   |
| `walletId`        | string  | No       | Wallet ID to use for signing (defaults to authenticated wallet)                   |
| `confirmed`       | boolean | No       | Omit to simulate first. Set to `true` only after the user approves the preview.   |

Example request:

```json theme={null}
{
  "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQABAgMEBQYH...",
  "networkId": "solana:mainnet"
}
```

### send\_evm\_transaction

Simulates, signs, and broadcasts an EVM transaction with automatic gas estimation.

| Parameter              | Type             | Required | Description                                                                                                                                         |
| ---------------------- | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `chainId`              | number \| string | Yes      | EVM chain ID (e.g., `1`, `"8453"`, or `"0x2105"`)                                                                                                   |
| `to`                   | string           | No       | Destination address (`0x`-prefixed)                                                                                                                 |
| `value`                | string           | No       | Value in wei as a hex string (e.g., `"0x0"`)                                                                                                        |
| `data`                 | string           | No       | Calldata as a hex string                                                                                                                            |
| `gas`                  | string           | No       | Gas limit as a hex string. Auto-estimated with a 20% buffer if omitted.                                                                             |
| `gasLimit`             | string           | No       | Alias for `gas` — accepted directly from DeFi aggregator responses (e.g. LI.FI). If both `gas` and `gasLimit` are provided, `gas` takes precedence. |
| `gasPrice`             | string           | No       | Legacy gas price in wei                                                                                                                             |
| `maxFeePerGas`         | string           | No       | EIP-1559 max fee per gas                                                                                                                            |
| `maxPriorityFeePerGas` | string           | No       | EIP-1559 priority fee                                                                                                                               |
| `nonce`                | string           | No       | Transaction nonce. Auto-fetched if omitted.                                                                                                         |
| `type`                 | string           | No       | Transaction type such as `"0x2"`                                                                                                                    |
| `derivationIndex`      | number           | No       | Derivation index for the account (default: `0`)                                                                                                     |
| `walletId`             | string           | No       | Wallet ID to use for signing (defaults to authenticated wallet)                                                                                     |
| `rpcUrl`               | string           | No       | Custom EVM RPC URL override                                                                                                                         |
| `confirmed`            | boolean          | No       | Omit to simulate first. Set to `true` only after the user approves the preview.                                                                     |

Example request:

```json theme={null}
{
  "chainId": 8453,
  "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "value": "0x2386F26FC10000",
  "data": "0x"
}
```

### sign\_solana\_message

Signs a UTF-8 message on Solana.

| Parameter         | Type   | Required | Description                                        |
| ----------------- | ------ | -------- | -------------------------------------------------- |
| `message`         | string | Yes      | The UTF-8 message to sign                          |
| `networkId`       | string | Yes      | Solana network identifier (e.g., `solana:mainnet`) |
| `derivationIndex` | number | No       | Derivation index for the account (default: `0`)    |

### sign\_evm\_personal\_message

Signs a UTF-8 message using EIP-191 personal signing for EVM chains.

| Parameter         | Type   | Required | Description                                            |
| ----------------- | ------ | -------- | ------------------------------------------------------ |
| `message`         | string | Yes      | The UTF-8 message to sign                              |
| `chainId`         | number | Yes      | EVM chain ID (e.g., `1` for Ethereum, `8453` for Base) |
| `derivationIndex` | number | No       | Derivation index for the account (default: `0`)        |

### sign\_evm\_typed\_data

Signs structured data using EIP-712 for EVM chains. Used for DeFi permits and other typed data flows.

| Parameter         | Type   | Required | Description                                            |
| ----------------- | ------ | -------- | ------------------------------------------------------ |
| `typedData`       | object | Yes      | EIP-712 typed data object                              |
| `chainId`         | number | Yes      | EVM chain ID (e.g., `1` for Ethereum, `8453` for Base) |
| `derivationIndex` | number | No       | Derivation index for the account (default: `0`)        |

### simulate\_transaction

Simulates a transaction and returns expected asset changes, security warnings, and blocking conditions without submitting on-chain. Use this to preview what a transaction will do before signing or sending. Supports Solana, EVM (Ethereum, Base, Polygon, Arbitrum, Monad), Sui, and Bitcoin.

The `userAccount` wallet address is auto-derived from the authenticated session for Solana and EVM chains. Supply it explicitly for Sui and Bitcoin.

| Parameter         | Type   | Required | Description                                                                        |
| ----------------- | ------ | -------- | ---------------------------------------------------------------------------------- |
| `chainId`         | string | Yes      | CAIP-2 chain ID (e.g., `solana:mainnet`, `eip155:1`, `eip155:8453`, `sui:mainnet`) |
| `type`            | string | Yes      | `transaction` or `message`                                                         |
| `params`          | object | Yes      | Chain-specific transaction parameters (see below)                                  |
| `url`             | string | No       | dApp origin URL where the transaction originates (e.g., `https://jup.ag`)          |
| `context`         | string | No       | Transaction context hint: `swap`, `bridge`, `send`, or `gaslessSwap`               |
| `userAccount`     | string | No       | Wallet address to simulate for. Auto-derived for Solana and EVM chains.            |
| `language`        | string | No       | Response language code (e.g., `en`, `es`, `ja`). Defaults to `en`.                 |
| `derivationIndex` | number | No       | Derivation index for address lookup (default: `0`)                                 |
| `walletId`        | string | No       | Wallet ID override (defaults to authenticated wallet)                              |

**Chain-specific `params` shapes:**

* **Solana:** `{ transactions: ["<base58>"] }`
* **EVM:** `{ transactions: [{ from, to, value, data, chainId, type }] }`
* **Sui:** `{ rawTransaction: "<bytes>" }`
* **Bitcoin:** `{ transaction: "<raw>", userAddresses?: ["bc1q..."] }`
* **EVM message:** `{ message: "0x..." }`

#### Response shape

The result is a discriminated union on `type` (`"transaction"` or `"message"`) with a strongly typed schema. Treat any non-empty `block` as a blocking condition that should prevent signing or sending.

| Field              | Type                           | Description                                                                   |
| ------------------ | ------------------------------ | ----------------------------------------------------------------------------- |
| `type`             | `"transaction"` \| `"message"` | Discriminator matching the request `type`.                                    |
| `block`            | object \| null                 | Blocking warning that should prevent the action. Omitted or `null` when safe. |
| `expectedChanges`  | array                          | Asset and message changes the user can expect.                                |
| `warnings`         | array                          | Non-blocking advisory warnings.                                               |
| `advancedDetails`  | object \| null                 | Chain-specific details for transaction or message scanning.                   |
| `error`            | string \| null                 | Error message for transactions, or a `SimulationErrorCode` enum for messages. |
| `simulationError`  | object \| null                 | Optional transaction simulation error details.                                |
| `occurredSlippage` | number \| null                 | Optional slippage value for swap-context transaction simulations.             |

Each `expectedChanges[]` entry is one of:

* `type: "AssetChange"` - `name`, `changeText`, `changeSign` (`PLUS` | `MINUS` | `EQUAL`), `asset` (`{ type: "fungible" | "collectible" | "native" | "unknown", symbol, decimals, amount, usdValue? }`), `changeType` (`approval` | `revokal` | `transfer` | `mint` | `unknown`), and optional `image`, `context`, `metadata`.
* `type: "MessageOnly"` - `message`, `fallbackMessage`, `changeType`, and optional `image`, `context`, `metadata`.

Each warning (`block` or `warnings[]`) has `{ message, severity, kind? }`. `severity` is an integer where lower numbers are more severe:

| Severity | Meaning        |
| -------- | -------------- |
| `1`      | Critical alert |
| `2`      | Alert          |
| `3`      | Critical error |
| `4`      | Error          |

`advancedDetails` shape depends on the chain and request type:

* **EVM transaction:** `{ chainId, advancedRows, gas, gasLimit, tokenChange?, contractAddresses }`. Each contract address has a `type` of `spender`, `contract`, or `unknown`.
* **Solana transaction:** `{ chainId, tokenChange, advancedRows, requestId, safeguard?, totalFee, feePayers }`.
* **Sui transaction:** `{ chainId, tokenChange, requestId, gas: { computationCost, storageCost, storageRebate, nonRefundableStorageFee, totalGasUsed } }`.
* **Bitcoin transaction:** `{ inputs, outputs }` with amounts in satoshis.
* **EVM message:** `{ contractAddress }`.
* **Solana message:** `{ errorSignInWithSolana }`.

Example transaction response (EVM transfer):

```json theme={null}
{
  "type": "transaction",
  "expectedChanges": [
    {
      "type": "AssetChange",
      "name": "Ether",
      "changeText": "-0.001 ETH",
      "changeSign": "MINUS",
      "changeType": "transfer",
      "fallbackMessage": "Send 0.001 ETH",
      "asset": {
        "type": "native",
        "symbol": "ETH",
        "decimals": 18,
        "amount": "1000000000000000",
        "usdValue": 2.19
      }
    }
  ],
  "warnings": [],
  "advancedDetails": {
    "chainId": "eip155:8453",
    "advancedRows": [],
    "gas": [21000],
    "gasLimit": 21000,
    "contractAddresses": []
  }
}
```

Example blocking response (malicious approval):

```json theme={null}
{
  "type": "transaction",
  "block": {
    "message": "This transaction grants unlimited spending approval to a flagged address.",
    "severity": 1,
    "kind": "malicious_approval"
  },
  "expectedChanges": [],
  "warnings": []
}
```

### get\_token\_allowance

Returns the ERC-20 token allowance granted by an owner address to a spender address on any supported EVM chain. Use this before a swap to check whether an approval transaction is needed. When `ownerAddress` is omitted, the authenticated wallet address is used automatically.

| Parameter         | Type             | Required | Description                                                                                                                 |
| ----------------- | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| `chainId`         | number \| string | Yes      | EVM chain ID (e.g., `8453` for Base, `1` for Ethereum). Accepts a number, decimal string, or hex string (e.g., `"0x2105"`). |
| `tokenAddress`    | string           | Yes      | ERC-20 token contract address (`0x`-prefixed)                                                                               |
| `spenderAddress`  | string           | Yes      | Address of the spender to check allowance for (e.g., a swap router)                                                         |
| `ownerAddress`    | string           | No       | Address of the token owner. Defaults to the authenticated wallet address.                                                   |
| `walletId`        | string           | No       | Wallet ID (defaults to authenticated wallet). Only used when `ownerAddress` is omitted.                                     |
| `derivationIndex` | number           | No       | Derivation index for the account (default: `0`). Only used when `ownerAddress` is omitted.                                  |
| `rpcUrl`          | string           | No       | Custom EVM RPC URL override                                                                                                 |

Example response:

```json theme={null}
{
  "chainId": 1,
  "tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "ownerAddress": "0xf81ea875f910eaf8e9b27167f018d0e1b696963a",
  "spenderAddress": "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
  "allowance": "0",
  "allowanceHex": "0x0"
}
```

### transfer\_tokens

Transfers native tokens or SPL/ERC-20 tokens across Solana and EVM chains using a simulation-first flow.

| Parameter                      | Type    | Required | Description                                                                     |
| ------------------------------ | ------- | -------- | ------------------------------------------------------------------------------- |
| `networkId`                    | string  | Yes      | Network identifier (e.g., `solana:mainnet`, `eip155:1`)                         |
| `to`                           | string  | Yes      | Recipient address                                                               |
| `amount`                       | string  | Yes      | Transfer amount as a string (e.g., `"0.5"`)                                     |
| `amountUnit`                   | string  | No       | `ui` for token units, `base` for atomic units (default: `ui`)                   |
| `tokenMint`                    | string  | No       | SPL mint or ERC-20 contract address. Omit for native token transfers            |
| `decimals`                     | number  | No       | Token decimals. Required for ERC-20 transfers when `amountUnit` is `ui`         |
| `derivationIndex`              | number  | No       | Derivation index for the account (default: `0`)                                 |
| `walletId`                     | string  | No       | Wallet ID to use (defaults to authenticated wallet)                             |
| `rpcUrl`                       | string  | No       | Custom Solana or EVM RPC URL override                                           |
| `createAssociatedTokenAccount` | boolean | No       | Solana only. Create destination ATA if missing (default: `true`)                |
| `confirmed`                    | boolean | No       | Omit to simulate first. Set to `true` only after the user approves the preview. |

Example (SOL transfer):

```json theme={null}
{
  "networkId": "solana:mainnet",
  "to": "H8FpYTgx4Uy9aF9Nk9fCTqKKFLYQ9KfC6UJhMkMDzCBh",
  "amount": "0.1"
}
```

## Swaps and portfolio

### buy\_token

**No fees on swaps.** Phantom does not charge transaction fees, platform fees, or commission on swaps executed through the MCP server. Your users keep what they swap.

Fetches a swap quote from the Phantom routing engine for Solana, EVM, and cross-chain swaps. Optionally signs and sends the initiation transaction when `execute: true`.

<Note>
  Cross-chain swaps work in both directions: Solana to EVM and EVM to Solana. Cross-chain swaps can also target Hypercore/Hyperliquid when supported.
</Note>

| Parameter           | Type    | Required | Description                                                                                                |
| ------------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| `amount`            | string  | Yes      | Sell amount (e.g., `"0.5"`)                                                                                |
| `sellChainId`       | string  | No       | CAIP-2 chain ID for the sell token (default: `solana:mainnet`)                                             |
| `buyChainId`        | string  | No       | CAIP-2 chain ID for the buy token (defaults to `sellChainId`; set a different value for cross-chain swaps) |
| `buyTokenMint`      | string  | No       | Token to buy. Solana mint address or EVM `0x` contract address (omit for native token)                     |
| `buyTokenIsNative`  | boolean | No       | `true` to buy the native token of the destination chain                                                    |
| `sellTokenMint`     | string  | No       | Token to sell. Solana mint address or EVM `0x` contract address (omit for native token)                    |
| `sellTokenIsNative` | boolean | No       | `true` to sell the native token (default when `sellTokenMint` is omitted)                                  |
| `amountUnit`        | string  | No       | `ui` for token units, `base` for atomic units (default: `base`)                                            |
| `sellTokenDecimals` | number  | No       | Decimals for the sell token. Required for EVM tokens when `amountUnit` is `ui`                             |
| `buyTokenDecimals`  | number  | No       | Decimals for the buy token. Required for EVM tokens when `amountUnit` is `ui` and `exactOut` is `true`     |
| `slippageTolerance` | number  | No       | Slippage tolerance in percent (0–100)                                                                      |
| `autoSlippage`      | boolean | No       | Enable automatic slippage calculation                                                                      |
| `exactOut`          | boolean | No       | If `true`, treat `amount` as the buy amount rather than the sell amount                                    |
| `execute`           | boolean | No       | If `true`, sign and send the initiation transaction immediately                                            |
| `taker`             | string  | No       | Override the taker address                                                                                 |
| `derivationIndex`   | number  | No       | Derivation index for the taker address (default: `0`)                                                      |
| `rpcUrl`            | string  | No       | Solana RPC URL override for token decimal lookup                                                           |
| `quoteApiUrl`       | string  | No       | Phantom-compatible quotes API URL override                                                                 |

Example (Solana swap: sell SOL for USDC):

```json theme={null}
{
  "amount": "0.1",
  "sellChainId": "solana:mainnet",
  "sellTokenIsNative": true,
  "buyTokenMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "amountUnit": "ui",
  "execute": true
}
```

Example (cross-chain swap: sell SOL for ETH on Base):

```json theme={null}
{
  "amount": "0.5",
  "sellChainId": "solana:mainnet",
  "sellTokenIsNative": true,
  "buyChainId": "eip155:8453",
  "buyTokenIsNative": true,
  "amountUnit": "ui",
  "execute": true
}
```

### portfolio\_rebalance

Analyzes portfolio allocation and rebalances via token swaps.

**No fees on any swaps executed during rebalancing.** Portfolio rebalancing uses the same zero-fee swap routing as `buy_token`.

Analyzes portfolio allocation and rebalances to target percentages via token swaps. Currently supports Solana only. Uses a two-phase flow: call with `phase: "analyze"` to inspect current allocations, then `phase: "execute"` with `targetAllocations` to rebalance. Use `dryRun: true` to preview without executing.

| Parameter           | Type    | Required | Description                                                                                                     |
| ------------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------- |
| `phase`             | string  | Yes      | `analyze` to view current allocations, `execute` to rebalance                                                   |
| `targetAllocations` | array   | No       | Required for `execute` phase. Array of `{caip19, targetPercent, symbol?}` objects. Percentages must sum to 100. |
| `dryRun`            | boolean | No       | If `true` during `execute` phase, returns the swap plan without executing (default: `false`)                    |
| `slippageTolerance` | number  | No       | Slippage tolerance in percent for each swap (default: `1`)                                                      |
| `minTradeUsd`       | number  | No       | Minimum USD value for a trade to execute (default: `1.0`)                                                       |
| `network`           | string  | No       | Network to rebalance on. Currently only `solana` is supported (default: `solana`).                              |

## Session and billing

### phantom\_login

Re-authenticates with Phantom. Use this to log in for the first time, switch accounts, or refresh an expired session. Opens the Phantom Connect browser flow.

No parameters.

### pay\_api\_access

Pays for daily API access when another tool returns `API_PAYMENT_REQUIRED`. Pass the `preparedTx` value from that error response, then retry the original tool call.

| Parameter         | Type   | Required | Description                                                                  |
| ----------------- | ------ | -------- | ---------------------------------------------------------------------------- |
| `preparedTx`      | string | Yes      | Base64-encoded unsigned Solana transaction returned by the API payment error |
| `derivationIndex` | number | No       | Derivation index for the account (default: `0`)                              |

## Perpetuals

<Note>
  Looking for a Hyperliquid-focused walkthrough instead of the full tool catalog? See the dedicated [perps tools guide](/phantom-mcp-server/perps).
</Note>

### Read-only

| Tool                     | Description                                                                                     |
| ------------------------ | ----------------------------------------------------------------------------------------------- |
| `get_perp_markets`       | Returns available perp markets with price, funding, open interest, 24h volume, and max leverage |
| `get_perp_account`       | Returns perp account balance and available trading margin                                       |
| `get_perp_positions`     | Returns open positions with size, direction, leverage, unrealized PnL, and liquidation price    |
| `get_perp_orders`        | Returns open perp orders such as limit, TP, and SL orders                                       |
| `get_perp_trade_history` | Returns historical fills with fees and closed PnL                                               |

### deposit\_to\_hyperliquid

Bridges tokens from an external chain (Solana, Arbitrum, Base, Ethereum, Polygon) into Hyperliquid as USDC via cross-chain swap. Uses a quote-first flow by default.

| Parameter         | Type    | Required | Description                                                                                                       |
| ----------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| `sourceChainId`   | string  | Yes      | Source chain CAIP-2 ID (e.g. `"solana:mainnet"`, `"eip155:42161"`, `"eip155:8453"`, `"eip155:1"`, `"eip155:137"`) |
| `amount`          | string  | Yes      | Amount to send in human-readable units (e.g. `"100"` for 100 USDC, `"0.5"` for 0.5 SOL)                           |
| `sellTokenMint`   | string  | No       | Token contract/mint address to sell. Omit for native token (SOL, ETH, etc.)                                       |
| `execute`         | boolean | No       | If `false` (default), returns the quote only. If `true`, signs and broadcasts immediately.                        |
| `walletId`        | string  | No       | Wallet ID (defaults to authenticated wallet)                                                                      |
| `derivationIndex` | number  | No       | Derivation index for the account (default: `0`)                                                                   |

Example (deposit SOL into Hyperliquid as USDC):

```json theme={null}
{
  "sourceChainId": "solana:mainnet",
  "amount": "10",
  "execute": true
}
```

### open\_perp\_position

Opens a market or limit long/short perpetual position.

| Parameter         | Type   | Required | Description                                                             |
| ----------------- | ------ | -------- | ----------------------------------------------------------------------- |
| `market`          | string | Yes      | Market symbol (e.g. `"BTC"`, `"ETH"`, `"SOL"`)                          |
| `direction`       | string | Yes      | `"long"` or `"short"`                                                   |
| `sizeUsd`         | string | Yes      | Position size in USD (e.g. `"100"` for \$100 notional value)            |
| `leverage`        | number | Yes      | Leverage multiplier (e.g. `1` for 1x, `10` for 10x)                     |
| `orderType`       | string | No       | `"market"` (default) or `"limit"`                                       |
| `limitPrice`      | string | No       | Required for limit orders: the limit price as a string (e.g. `"50000"`) |
| `marginType`      | string | No       | `"cross"` or `"isolated"`                                               |
| `walletId`        | string | No       | Wallet ID (defaults to authenticated wallet)                            |
| `derivationIndex` | number | No       | Derivation index for the account (default: `0`)                         |

Example (market long):

```json theme={null}
{
  "market": "ETH",
  "direction": "long",
  "sizeUsd": "100",
  "leverage": 5
}
```

### close\_perp\_position

Closes a perpetual position fully or partially.

| Parameter         | Type   | Required | Description                                                            |
| ----------------- | ------ | -------- | ---------------------------------------------------------------------- |
| `market`          | string | Yes      | Market symbol of the position to close (e.g. `"BTC"`)                  |
| `sizePercent`     | number | No       | Percentage of position to close (0–100, default: `100` for full close) |
| `walletId`        | string | No       | Wallet ID (defaults to authenticated wallet)                           |
| `derivationIndex` | number | No       | Derivation index for the account (default: `0`)                        |

### cancel\_perp\_order

Cancels an open perpetual order by ID.

| Parameter         | Type    | Required | Description                                             |
| ----------------- | ------- | -------- | ------------------------------------------------------- |
| `market`          | string  | Yes      | Market symbol (e.g. `"BTC"`)                            |
| `orderId`         | integer | Yes      | The numeric order ID to cancel (from `get_perp_orders`) |
| `walletId`        | string  | No       | Wallet ID (defaults to authenticated wallet)            |
| `derivationIndex` | number  | No       | Derivation index for the account (default: `0`)         |

### update\_perp\_leverage

Updates leverage and margin mode for a market.

| Parameter         | Type   | Required | Description                                         |
| ----------------- | ------ | -------- | --------------------------------------------------- |
| `market`          | string | Yes      | Market symbol (e.g. `"BTC"`)                        |
| `leverage`        | number | Yes      | Leverage multiplier (e.g. `1` for 1x, `10` for 10x) |
| `marginType`      | string | No       | `"cross"` or `"isolated"`                           |
| `walletId`        | string | No       | Wallet ID (defaults to authenticated wallet)        |
| `derivationIndex` | number | No       | Derivation index for the account (default: `0`)     |

### transfer\_spot\_to\_perps

Moves USDC from Hypercore spot into the perps margin account.

| Parameter         | Type   | Required | Description                                                           |
| ----------------- | ------ | -------- | --------------------------------------------------------------------- |
| `amountUsdc`      | string | Yes      | Amount of USDC to move from spot to perps (e.g. `"100"` for 100 USDC) |
| `walletId`        | string | No       | Wallet ID (defaults to authenticated wallet)                          |
| `derivationIndex` | number | No       | Derivation index for the account (default: `0`)                       |

### withdraw\_from\_perps

Bridges USDC from the Hyperliquid perpetuals account to an external chain (Solana, Base, Ethereum, Arbitrum, Polygon) via the Relay bridge.

| Parameter            | Type   | Required | Description                                                                                                            |
| -------------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| `amountUsdc`         | string | Yes      | Amount of USDC to withdraw (e.g. `"50"` for 50 USDC)                                                                   |
| `destinationChainId` | string | Yes      | Destination chain CAIP-2 ID (e.g. `"solana:mainnet"`, `"eip155:8453"`, `"eip155:1"`, `"eip155:42161"`, `"eip155:137"`) |
| `buyToken`           | string | No       | CAIP-19 token to receive on the destination chain. Defaults to USDC on the destination chain if omitted.               |
| `walletId`           | string | No       | Wallet ID (defaults to authenticated wallet)                                                                           |
| `derivationIndex`    | number | No       | Derivation index for the account (default: `0`)                                                                        |

**Example:**

```json theme={null}
{
  "amountUsdc": "50",
  "destinationChainId": "solana:mainnet"
}
```

All perp write tools submit signed actions immediately (except `deposit_to_hyperliquid` which uses a quote-first flow). Use `get_perp_markets`, `get_perp_account`, and `get_perp_positions` first to verify the intended trade.

### Funding flow

Moving funds in and out of perps is a two-step process:

**Deposit chain** (external → perps):

1. `deposit_to_hyperliquid` — bridges tokens from Solana, Arbitrum, Base, Ethereum, or Polygon into Hyperliquid spot as USDC.
2. `transfer_spot_to_perps` — moves USDC from Hyperliquid spot into the perps margin account.

**Withdraw chain** (perps → external):

1. `withdraw_from_perps` — bridges USDC from perps directly to the destination chain in one step.

To withdraw USDC from Hyperliquid **spot** (not perps), use `phantom perps withdraw-hl-spot` in the [CLI](/phantom-cli/commands). This command replaces the `withdraw_from_hyperliquid_spot` MCP tool from earlier releases, which has been removed.

## Supported networks

Network identifiers follow the CAIP-2/CAIP-10 format.

### Solana

| Network | Identifier       |
| ------- | ---------------- |
| Mainnet | `solana:mainnet` |
| Devnet  | `solana:devnet`  |
| Testnet | `solana:testnet` |

### Ethereum and EVM networks

| Network          | Identifier        |
| ---------------- | ----------------- |
| Ethereum Mainnet | `eip155:1`        |
| Ethereum Sepolia | `eip155:11155111` |
| Polygon Mainnet  | `eip155:137`      |
| Polygon Amoy     | `eip155:80002`    |
| Base Mainnet     | `eip155:8453`     |
| Base Sepolia     | `eip155:84532`    |
| Arbitrum One     | `eip155:42161`    |
| Arbitrum Sepolia | `eip155:421614`   |
| Monad            | `eip155:143`      |
| Monad Testnet    | `eip155:10143`    |

### Bitcoin

| Network | Identifier                                |
| ------- | ----------------------------------------- |
| Mainnet | `bip122:000000000019d6689c085ae165831e93` |

### Sui

| Network | Identifier    |
| ------- | ------------- |
| Mainnet | `sui:mainnet` |
| Testnet | `sui:testnet` |
