Gate Exchange Sub-Account Skill
General Rules
⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding.
Do NOT select or call any tool until all rules are read. These rules have the highest priority.
→ Read gate-runtime-rules.md
- Only call MCP tools explicitly listed in this skill. Tools not documented here must NOT be called, even if they
exist in the MCP server.
MCP Dependencies
Required MCP Servers
| MCP Server |
Status |
| Gate (main) |
✅ Required |
MCP Tools Used
Query Operations (Read-only)
- cex_sa_get_sa
- cex_sa_list_sas
- cex_sa_lock_sa
- cex_sa_unlock_sa
Execution Operations (Write)
Authentication
Installation Check
- Required: Gate (main)
- Install: Run installer skill for your IDE
- Cursor:
gate-mcp-cursor-installer
- Codex:
gate-mcp-codex-installer
- Claude:
gate-mcp-claude-installer
- OpenClaw:
gate-mcp-openclaw-installer
Prerequisites
- MCP Dependency: Requires gate-mcp to be installed.
- Authentication: All sub-account operations require API key authentication with main-account privileges.
- Permission: The current user must be a main account holder to manage sub-accounts.
Available MCP Tools
| Tool |
Auth |
Description |
cex_sa_get_sa |
Yes |
Get details of a specific sub-account by user ID |
cex_sa_list_sas |
Yes |
List all sub-accounts under the main account |
cex_sa_create_sa |
Yes |
Create a new normal sub-account |
cex_sa_lock_sa |
Yes |
Lock a sub-account to disable login and trading |
cex_sa_unlock_sa |
Yes |
Unlock a previously locked sub-account |
Workflow
Step 1: Identify User Intent
Parse the user's message to determine which sub-account operation they need.
Key data to extract:
intent: One of query_status, list_all, create, lock, unlock
user_id: Sub-account UID (required for query_status, lock, unlock)
login_name: Desired username (for create, may need to ask user)
Intent detection rules:
| Signal Keywords |
Intent |
| "status of sub-account", "sub-account UID {id}", "check sub-account" |
query_status |
| "all sub-accounts", "list sub-accounts", "my sub-accounts", "which sub-accounts" |
list_all |
| "create sub-account", "new sub-account", "add sub-account" |
create |
| "lock sub-account", "disable sub-account", "freeze sub-account" |
lock |
| "unlock sub-account", "enable sub-account", "unfreeze sub-account" |
unlock |
Step 2: Execute by Intent
Case A: Query Sub-Account Status (query_status)
Call cex_sa_get_sa with:
user_id: The sub-account UID provided by the user
Key data to extract:
login_name: Sub-account username
remark: Sub-account remark/note
state: Account state (normal / locked)
type: Account type (normal / pool)
create_time: Account creation timestamp
Present the sub-account details in a structured format.
Case B: List All Sub-Accounts (list_all)
Call cex_sa_list_sas with:
type: "0" (normal sub-accounts only)
Key data to extract:
- For each sub-account:
user_id, login_name, remark, state, create_time
Present results as a table with username, UID, remark (if any), and current status.
Case C: Create Sub-Account (create)
Pre-check: Call cex_sa_list_sas with type: "0" to get the current list of normal sub-accounts. Check if the user can still create more sub-accounts based on the returned count.
If creation is available:
- Ask the user to provide a login name for the new sub-account
- Optionally collect: email, remark
- Confirm all details with the user before proceeding
- Call
cex_sa_create_sa with:
login_name: User-provided login name (required)
email: User-provided email (optional)
remark: User-provided remark (optional)
- Present the newly created sub-account details
Key data to extract:
user_id: Newly created sub-account UID
login_name: Confirmed username
state: Should be "normal"
Important: Only normal sub-accounts can be created through this skill.
Case D: Lock Sub-Account (lock)
- Validate that
user_id is provided; if not, ask the user
- Call
cex_sa_get_sa with user_id to verify the sub-account exists and belongs to the main account
- If the sub-account is already locked, inform the user and stop
- Confirm with the user: "Are you sure you want to lock sub-account {user_id} ({login_name})? This will disable login and trading for this sub-account."
- On confirmation, call
cex_sa_lock_sa with:
user_id: The sub-account UID
- Report the result
Key data to extract:
- Lock operation success/failure status
Case E: Unlock Sub-Account (unlock)
- Validate that
user_id is provided; if not, ask the user
- Call
cex_sa_get_sa with user_id to verify the sub-account exists and is currently locked
- If the sub-account is already unlocked/normal, inform the user and stop
- Confirm with the user: "Are you sure you want to unlock sub-account {user_id} ({login_name})?"
- On confirmation, call
cex_sa_unlock_sa with:
user_id: The sub-account UID
- Report the result
Key data to extract:
- Unlock operation success/failure status
Step 3: Format and Respond
Present results using the Report Template below. Always include relevant context and next-step suggestions.
Judgment Logic Summary
| Condition |
Action |
| User asks for a specific sub-account status with UID |
Route to Case A: query_status |
| User asks to see all sub-accounts |
Route to Case B: list_all |
| User wants to create a new sub-account |
Route to Case C: create |
| User wants to lock a sub-account with UID |
Route to Case D: lock |
| User wants to unlock a sub-account with UID |
Route to Case E: unlock |
| UID not provided for operations requiring it |
Ask user for the sub-account UID |
| Login name not provided for creation |
Ask user for a login name |
| Sub-account already in target state (lock/unlock) |
Inform user, no action needed |
| API returns authentication error |
Prompt user to log in |
| API returns permission error |
Inform user that main account privileges are required |
| Sub-account does not exist or does not belong to user |
Inform user the UID is invalid |
Report Template
Query Status Response
Sub-Account Details
---
Username: {login_name}
UID: {user_id}
Status: {state}
Type: {type}
Remark: {remark or "N/A"}
Created: {create_time}
List All Sub-Accounts Response
Your Sub-Accounts
---
| # | Username | UID | Status | Remark |
|---|----------|-----|--------|--------|
| 1 | {login_name} | {user_id} | {state} | {remark or "-"} |
| 2 | ... | ... | ... | ... |
Total: {count} sub-account(s)
Create Sub-Account Response
Sub-Account Created Successfully
---
Username: {login_name}
UID: {user_id}
Status: Normal
Remark: {remark or "N/A"}
Note: Only normal sub-accounts can be created through this interface.
Lock/Unlock Response
Sub-Account {Action} Successfully
---
Username: {login_name}
UID: {user_id}
Previous Status: {previous_state}
Current Status: {new_state}
Domain Knowledge
- A main account on Gate can create multiple sub-accounts for asset isolation, strategy separation, or team management.
- Sub-accounts share the main account's KYC verification but have independent trading and wallet capabilities.
- Locking a sub-account disables both login and trading; the assets remain safe but inaccessible until unlocked.
- There are two types of sub-accounts: normal (type=0) and pool (type=1). This skill only supports creating normal sub-accounts.
- Sub-account creation requires a unique login name. Email and remark are optional.
Safety Rules
- Write operations (
cex_sa_create_sa, cex_sa_lock_sa, cex_sa_unlock_sa): Always require explicit user confirmation before execution. Never auto-execute.
- UID validation: Before lock/unlock, always verify the sub-account exists and belongs to the current main account.
- State check: Before lock/unlock, check current state to avoid redundant operations.
- No sensitive data exposure: Never expose API keys, internal endpoint URLs, or raw error traces.
- Normal sub-accounts only: Creation is restricted to normal sub-accounts (type=0). Do not attempt to create pool sub-accounts.
Error Handling
| Condition |
Response |
| Auth endpoint returns "not login" |
"Please log in to your Gate account first." |
| User is not a main account |
"Sub-account management requires main account privileges. Please switch to your main account." |
| Sub-account UID not found |
"Sub-account with UID {user_id} was not found. Please verify the UID and try again." |
| Sub-account does not belong to user |
"This sub-account does not belong to your main account." |
| Sub-account already locked |
"Sub-account {user_id} is already locked. No action needed." |
| Sub-account already unlocked |
"Sub-account {user_id} is already in normal (unlocked) state. No action needed." |
| Create sub-account fails (limit reached) |
"You have reached the maximum number of sub-accounts. Please contact support if you need more." |
| Create sub-account fails (duplicate name) |
"The login name '{login_name}' is already taken. Please choose a different name." |
| Unknown error |
"An error occurred while processing your request. Please try again later." |
Prompt Examples & Scenarios
See scenarios.md for full prompt examples and expected behaviors.
1---2name: gate-exchange-subaccount3description: Manage sub-accounts on Gate Exchange including querying status, listing, creating, locking, and unlocking sub-accounts. Use this skill whenever the user asks about sub-account management, sub-account status, creating sub-accounts, locking or unlocking sub-accounts. Trigger phrases include "sub-account", "subaccount", "sub account status", "create sub-account", "lock sub-account", "unlock sub-account", "list sub-accounts", "my sub-accounts", or any request involving sub-account queries or management operations.4---56# Gate Exchange Sub-Account Skill78## General Rules910⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding.11Do NOT select or call any tool until all rules are read. These rules have the highest priority.12→ Read [gate-runtime-rules.md](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md)13- **Only call MCP tools explicitly listed in this skill.** Tools not documented here must NOT be called, even if they14 exist in the MCP server.151617---1819## MCP Dependencies2021### Required MCP Servers22| MCP Server | Status |23|------------|--------|24| Gate (main) | ✅ Required |2526### MCP Tools Used2728**Query Operations (Read-only)**2930- cex_sa_get_sa31- cex_sa_list_sas32- cex_sa_lock_sa33- cex_sa_unlock_sa3435**Execution Operations (Write)**3637- cex_sa_create_sa3839### Authentication40- API Key Required: Yes (see skill doc/runtime MCP deployment)41- Permissions: Sa:Write42- Get API Key: https://www.gate.io/myaccount/profile/api-key/manage4344### Installation Check45- Required: Gate (main)46- Install: Run installer skill for your IDE47 - Cursor: `gate-mcp-cursor-installer`48 - Codex: `gate-mcp-codex-installer`49 - Claude: `gate-mcp-claude-installer`50 - OpenClaw: `gate-mcp-openclaw-installer`5152## Prerequisites5354- **MCP Dependency**: Requires [gate-mcp](https://github.com/gate/gate-mcp) to be installed.55- **Authentication**: All sub-account operations require API key authentication with main-account privileges.56- **Permission**: The current user must be a main account holder to manage sub-accounts.5758## Available MCP Tools5960| Tool | Auth | Description |61|------|------|-------------|62| `cex_sa_get_sa` | Yes | Get details of a specific sub-account by user ID |63| `cex_sa_list_sas` | Yes | List all sub-accounts under the main account |64| `cex_sa_create_sa` | Yes | Create a new normal sub-account |65| `cex_sa_lock_sa` | Yes | Lock a sub-account to disable login and trading |66| `cex_sa_unlock_sa` | Yes | Unlock a previously locked sub-account |6768## Workflow6970### Step 1: Identify User Intent7172Parse the user's message to determine which sub-account operation they need.7374Key data to extract:75- `intent`: One of `query_status`, `list_all`, `create`, `lock`, `unlock`76- `user_id`: Sub-account UID (required for `query_status`, `lock`, `unlock`)77- `login_name`: Desired username (for `create`, may need to ask user)7879Intent detection rules:8081| Signal Keywords | Intent |82|----------------|--------|83| "status of sub-account", "sub-account UID {id}", "check sub-account" | `query_status` |84| "all sub-accounts", "list sub-accounts", "my sub-accounts", "which sub-accounts" | `list_all` |85| "create sub-account", "new sub-account", "add sub-account" | `create` |86| "lock sub-account", "disable sub-account", "freeze sub-account" | `lock` |87| "unlock sub-account", "enable sub-account", "unfreeze sub-account" | `unlock` |8889### Step 2: Execute by Intent9091#### Case A: Query Sub-Account Status (`query_status`)9293Call `cex_sa_get_sa` with:94- `user_id`: The sub-account UID provided by the user9596Key data to extract:97- `login_name`: Sub-account username98- `remark`: Sub-account remark/note99- `state`: Account state (normal / locked)100- `type`: Account type (normal / pool)101- `create_time`: Account creation timestamp102103Present the sub-account details in a structured format.104105#### Case B: List All Sub-Accounts (`list_all`)106107Call `cex_sa_list_sas` with:108- `type`: "0" (normal sub-accounts only)109110Key data to extract:111- For each sub-account: `user_id`, `login_name`, `remark`, `state`, `create_time`112113Present results as a table with username, UID, remark (if any), and current status.114115#### Case C: Create Sub-Account (`create`)116117**Pre-check**: Call `cex_sa_list_sas` with `type`: "0" to get the current list of normal sub-accounts. Check if the user can still create more sub-accounts based on the returned count.118119If creation is available:1201. Ask the user to provide a login name for the new sub-account1212. Optionally collect: email, remark1223. Confirm all details with the user before proceeding1234. Call `cex_sa_create_sa` with:124 - `login_name`: User-provided login name (required)125 - `email`: User-provided email (optional)126 - `remark`: User-provided remark (optional)1275. Present the newly created sub-account details128129Key data to extract:130- `user_id`: Newly created sub-account UID131- `login_name`: Confirmed username132- `state`: Should be "normal"133134**Important**: Only normal sub-accounts can be created through this skill.135136#### Case D: Lock Sub-Account (`lock`)1371381. Validate that `user_id` is provided; if not, ask the user1392. Call `cex_sa_get_sa` with `user_id` to verify the sub-account exists and belongs to the main account1403. If the sub-account is already locked, inform the user and stop1414. Confirm with the user: "Are you sure you want to lock sub-account {user_id} ({login_name})? This will disable login and trading for this sub-account."1425. On confirmation, call `cex_sa_lock_sa` with:143 - `user_id`: The sub-account UID1446. Report the result145146Key data to extract:147- Lock operation success/failure status148149#### Case E: Unlock Sub-Account (`unlock`)1501511. Validate that `user_id` is provided; if not, ask the user1522. Call `cex_sa_get_sa` with `user_id` to verify the sub-account exists and is currently locked1533. If the sub-account is already unlocked/normal, inform the user and stop1544. Confirm with the user: "Are you sure you want to unlock sub-account {user_id} ({login_name})?"1555. On confirmation, call `cex_sa_unlock_sa` with:156 - `user_id`: The sub-account UID1576. Report the result158159Key data to extract:160- Unlock operation success/failure status161162### Step 3: Format and Respond163164Present results using the Report Template below. Always include relevant context and next-step suggestions.165166## Judgment Logic Summary167168| Condition | Action |169|-----------|--------|170| User asks for a specific sub-account status with UID | Route to Case A: `query_status` |171| User asks to see all sub-accounts | Route to Case B: `list_all` |172| User wants to create a new sub-account | Route to Case C: `create` |173| User wants to lock a sub-account with UID | Route to Case D: `lock` |174| User wants to unlock a sub-account with UID | Route to Case E: `unlock` |175| UID not provided for operations requiring it | Ask user for the sub-account UID |176| Login name not provided for creation | Ask user for a login name |177| Sub-account already in target state (lock/unlock) | Inform user, no action needed |178| API returns authentication error | Prompt user to log in |179| API returns permission error | Inform user that main account privileges are required |180| Sub-account does not exist or does not belong to user | Inform user the UID is invalid |181182## Report Template183184### Query Status Response185186```187Sub-Account Details188---189Username: {login_name}190UID: {user_id}191Status: {state}192Type: {type}193Remark: {remark or "N/A"}194Created: {create_time}195```196197### List All Sub-Accounts Response198199```200Your Sub-Accounts201---202| # | Username | UID | Status | Remark |203|---|----------|-----|--------|--------|204| 1 | {login_name} | {user_id} | {state} | {remark or "-"} |205| 2 | ... | ... | ... | ... |206207Total: {count} sub-account(s)208```209210### Create Sub-Account Response211212```213Sub-Account Created Successfully214---215Username: {login_name}216UID: {user_id}217Status: Normal218Remark: {remark or "N/A"}219220Note: Only normal sub-accounts can be created through this interface.221```222223### Lock/Unlock Response224225```226Sub-Account {Action} Successfully227---228Username: {login_name}229UID: {user_id}230Previous Status: {previous_state}231Current Status: {new_state}232```233234## Domain Knowledge235236- A main account on Gate can create multiple sub-accounts for asset isolation, strategy separation, or team management.237- Sub-accounts share the main account's KYC verification but have independent trading and wallet capabilities.238- Locking a sub-account disables both login and trading; the assets remain safe but inaccessible until unlocked.239- There are two types of sub-accounts: normal (type=0) and pool (type=1). This skill only supports creating normal sub-accounts.240- Sub-account creation requires a unique login name. Email and remark are optional.241242## Safety Rules243244- **Write operations** (`cex_sa_create_sa`, `cex_sa_lock_sa`, `cex_sa_unlock_sa`): Always require explicit user confirmation before execution. Never auto-execute.245- **UID validation**: Before lock/unlock, always verify the sub-account exists and belongs to the current main account.246- **State check**: Before lock/unlock, check current state to avoid redundant operations.247- **No sensitive data exposure**: Never expose API keys, internal endpoint URLs, or raw error traces.248- **Normal sub-accounts only**: Creation is restricted to normal sub-accounts (type=0). Do not attempt to create pool sub-accounts.249250## Error Handling251252| Condition | Response |253|-----------|----------|254| Auth endpoint returns "not login" | "Please log in to your Gate account first." |255| User is not a main account | "Sub-account management requires main account privileges. Please switch to your main account." |256| Sub-account UID not found | "Sub-account with UID {user_id} was not found. Please verify the UID and try again." |257| Sub-account does not belong to user | "This sub-account does not belong to your main account." |258| Sub-account already locked | "Sub-account {user_id} is already locked. No action needed." |259| Sub-account already unlocked | "Sub-account {user_id} is already in normal (unlocked) state. No action needed." |260| Create sub-account fails (limit reached) | "You have reached the maximum number of sub-accounts. Please contact support if you need more." |261| Create sub-account fails (duplicate name) | "The login name '{login_name}' is already taken. Please choose a different name." |262| Unknown error | "An error occurred while processing your request. Please try again later." |263264## Prompt Examples & Scenarios265266See [scenarios.md](references/scenarios.md) for full prompt examples and expected behaviors.