Gate Exchange Sub-Account Skill
Provide sub-account management capabilities on Gate, including querying sub-account status, listing all sub-accounts, creating new sub-accounts, and locking/unlocking sub-accounts.
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 Skill78Provide sub-account management capabilities on Gate, including querying sub-account status, listing all sub-accounts, creating new sub-accounts, and locking/unlocking sub-accounts.910## Prerequisites1112- **MCP Dependency**: Requires [gate-mcp](https://github.com/gate/gate-mcp) to be installed.13- **Authentication**: All sub-account operations require API key authentication with main-account privileges.14- **Permission**: The current user must be a main account holder to manage sub-accounts.1516## Available MCP Tools1718| Tool | Auth | Description |19|------|------|-------------|20| `cex_sa_get_sa` | Yes | Get details of a specific sub-account by user ID |21| `cex_sa_list_sas` | Yes | List all sub-accounts under the main account |22| `cex_sa_create_sa` | Yes | Create a new normal sub-account |23| `cex_sa_lock_sa` | Yes | Lock a sub-account to disable login and trading |24| `cex_sa_unlock_sa` | Yes | Unlock a previously locked sub-account |2526## Workflow2728### Step 1: Identify User Intent2930Parse the user's message to determine which sub-account operation they need.3132Key data to extract:33- `intent`: One of `query_status`, `list_all`, `create`, `lock`, `unlock`34- `user_id`: Sub-account UID (required for `query_status`, `lock`, `unlock`)35- `login_name`: Desired username (for `create`, may need to ask user)3637Intent detection rules:3839| Signal Keywords | Intent |40|----------------|--------|41| "status of sub-account", "sub-account UID {id}", "check sub-account" | `query_status` |42| "all sub-accounts", "list sub-accounts", "my sub-accounts", "which sub-accounts" | `list_all` |43| "create sub-account", "new sub-account", "add sub-account" | `create` |44| "lock sub-account", "disable sub-account", "freeze sub-account" | `lock` |45| "unlock sub-account", "enable sub-account", "unfreeze sub-account" | `unlock` |4647### Step 2: Execute by Intent4849#### Case A: Query Sub-Account Status (`query_status`)5051Call `cex_sa_get_sa` with:52- `user_id`: The sub-account UID provided by the user5354Key data to extract:55- `login_name`: Sub-account username56- `remark`: Sub-account remark/note57- `state`: Account state (normal / locked)58- `type`: Account type (normal / pool)59- `create_time`: Account creation timestamp6061Present the sub-account details in a structured format.6263#### Case B: List All Sub-Accounts (`list_all`)6465Call `cex_sa_list_sas` with:66- `type`: "0" (normal sub-accounts only)6768Key data to extract:69- For each sub-account: `user_id`, `login_name`, `remark`, `state`, `create_time`7071Present results as a table with username, UID, remark (if any), and current status.7273#### Case C: Create Sub-Account (`create`)7475**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.7677If creation is available:781. Ask the user to provide a login name for the new sub-account792. Optionally collect: email, remark803. Confirm all details with the user before proceeding814. Call `cex_sa_create_sa` with:82 - `login_name`: User-provided login name (required)83 - `email`: User-provided email (optional)84 - `remark`: User-provided remark (optional)855. Present the newly created sub-account details8687Key data to extract:88- `user_id`: Newly created sub-account UID89- `login_name`: Confirmed username90- `state`: Should be "normal"9192**Important**: Only normal sub-accounts can be created through this skill.9394#### Case D: Lock Sub-Account (`lock`)95961. Validate that `user_id` is provided; if not, ask the user972. Call `cex_sa_get_sa` with `user_id` to verify the sub-account exists and belongs to the main account983. If the sub-account is already locked, inform the user and stop994. 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."1005. On confirmation, call `cex_sa_lock_sa` with:101 - `user_id`: The sub-account UID1026. Report the result103104Key data to extract:105- Lock operation success/failure status106107#### Case E: Unlock Sub-Account (`unlock`)1081091. Validate that `user_id` is provided; if not, ask the user1102. Call `cex_sa_get_sa` with `user_id` to verify the sub-account exists and is currently locked1113. If the sub-account is already unlocked/normal, inform the user and stop1124. Confirm with the user: "Are you sure you want to unlock sub-account {user_id} ({login_name})?"1135. On confirmation, call `cex_sa_unlock_sa` with:114 - `user_id`: The sub-account UID1156. Report the result116117Key data to extract:118- Unlock operation success/failure status119120### Step 3: Format and Respond121122Present results using the Report Template below. Always include relevant context and next-step suggestions.123124## Judgment Logic Summary125126| Condition | Action |127|-----------|--------|128| User asks for a specific sub-account status with UID | Route to Case A: `query_status` |129| User asks to see all sub-accounts | Route to Case B: `list_all` |130| User wants to create a new sub-account | Route to Case C: `create` |131| User wants to lock a sub-account with UID | Route to Case D: `lock` |132| User wants to unlock a sub-account with UID | Route to Case E: `unlock` |133| UID not provided for operations requiring it | Ask user for the sub-account UID |134| Login name not provided for creation | Ask user for a login name |135| Sub-account already in target state (lock/unlock) | Inform user, no action needed |136| API returns authentication error | Prompt user to log in |137| API returns permission error | Inform user that main account privileges are required |138| Sub-account does not exist or does not belong to user | Inform user the UID is invalid |139140## Report Template141142### Query Status Response143144```145Sub-Account Details146---147Username: {login_name}148UID: {user_id}149Status: {state}150Type: {type}151Remark: {remark or "N/A"}152Created: {create_time}153```154155### List All Sub-Accounts Response156157```158Your Sub-Accounts159---160| # | Username | UID | Status | Remark |161|---|----------|-----|--------|--------|162| 1 | {login_name} | {user_id} | {state} | {remark or "-"} |163| 2 | ... | ... | ... | ... |164165Total: {count} sub-account(s)166```167168### Create Sub-Account Response169170```171Sub-Account Created Successfully172---173Username: {login_name}174UID: {user_id}175Status: Normal176Remark: {remark or "N/A"}177178Note: Only normal sub-accounts can be created through this interface.179```180181### Lock/Unlock Response182183```184Sub-Account {Action} Successfully185---186Username: {login_name}187UID: {user_id}188Previous Status: {previous_state}189Current Status: {new_state}190```191192## Domain Knowledge193194- A main account on Gate can create multiple sub-accounts for asset isolation, strategy separation, or team management.195- Sub-accounts share the main account's KYC verification but have independent trading and wallet capabilities.196- Locking a sub-account disables both login and trading; the assets remain safe but inaccessible until unlocked.197- There are two types of sub-accounts: normal (type=0) and pool (type=1). This skill only supports creating normal sub-accounts.198- Sub-account creation requires a unique login name. Email and remark are optional.199200## Safety Rules201202- **Write operations** (`cex_sa_create_sa`, `cex_sa_lock_sa`, `cex_sa_unlock_sa`): Always require explicit user confirmation before execution. Never auto-execute.203- **UID validation**: Before lock/unlock, always verify the sub-account exists and belongs to the current main account.204- **State check**: Before lock/unlock, check current state to avoid redundant operations.205- **No sensitive data exposure**: Never expose API keys, internal endpoint URLs, or raw error traces.206- **Normal sub-accounts only**: Creation is restricted to normal sub-accounts (type=0). Do not attempt to create pool sub-accounts.207208## Error Handling209210| Condition | Response |211|-----------|----------|212| Auth endpoint returns "not login" | "Please log in to your Gate account first." |213| User is not a main account | "Sub-account management requires main account privileges. Please switch to your main account." |214| Sub-account UID not found | "Sub-account with UID {user_id} was not found. Please verify the UID and try again." |215| Sub-account does not belong to user | "This sub-account does not belong to your main account." |216| Sub-account already locked | "Sub-account {user_id} is already locked. No action needed." |217| Sub-account already unlocked | "Sub-account {user_id} is already in normal (unlocked) state. No action needed." |218| Create sub-account fails (limit reached) | "You have reached the maximum number of sub-accounts. Please contact support if you need more." |219| Create sub-account fails (duplicate name) | "The login name '{login_name}' is already taken. Please choose a different name." |220| Unknown error | "An error occurred while processing your request. Please try again later." |221222## Prompt Examples & Scenarios223224See [scenarios.md](references/scenarios.md) for full prompt examples and expected behaviors.