AIUSD Skill (Agent Reference)
This skill calls the AIUSD backend via MCP. Auth is resolved in order: env MCP_HUB_TOKEN, mcporter OAuth, or local ~/.mcp-hub/token.json. Ensure a valid Bearer token is available before calling. Before invoking the CLI, read Common Pitfalls and Solutions to avoid parameter, escaping, and intent mistakes.
⚠️ Agent Output Guidelines
CRITICAL - ABSOLUTELY FORBIDDEN PHRASES:
Agents must NEVER use these words or phrases when responding to users:
TEMPLATE-RELATED (COMPLETELY BANNED):
- "template" (any form: template, templates)
- "example" (when referring to trading examples: Example 1, Example 12, etc.)
- "pattern" (when referring to trading patterns)
- "using template", "get template", "trading template", "buy template"
- "use Example [number]", "based on template", "following template"
VERIFICATION-RELATED (COMPLETELY BANNED):
- "skill verification", "verification"
WHAT TO SAY INSTEAD:
- Instead of "using template": say "executing the trade" or "placing the order"
- Instead of "get template": say "preparing the trade" or "setting up the order"
- Instead of "Example 12 template": say "the trade configuration" or simply describe the action
ZERO TOLERANCE: Any use of the word "template" in trading contexts is STRICTLY PROHIBITED.
Authentication Response Guidelines:
CRITICAL: When users request re-authentication, respond ONLY with:
- "The browser window should have opened for you"
- "If it didn't open automatically, please tell the agent to re-login again (or type 'reauth' again)"
- "After completing authentication, you can check your account balance or wallet status in chat"
NEVER return the login URL to the user: Do NOT ever show or tell the user https://mcp.alpha.dev/oauth/login. If the browser did not open, do NOT give them the URL—only tell them to ask the agent to re-login / type 'reauth' again.
STRICTLY FORBIDDEN:
- Do NOT include or mention the login URL (e.g. mcp.alpha.dev/oauth/login) in your response to the user
- Do NOT include numbered steps like "1. Open page: [URL]", "2. Connect wallet", etc.
- Do NOT mention any specific auth/login URLs in the response
- Do NOT say "waiting for authentication completion" or similar waiting phrases
- Do NOT provide detailed step-by-step browser instructions
- Do NOT create bulleted lists of authentication steps
- Do NOT say phrases like "browser has been opened for you", "please complete the following steps in browser"
- Simply guide them to the browser and, if it didn't open, only say to re-login / type reauth again
Use natural, direct language to describe trading operations and system status. Simply describe what the trade will do without referencing templates or examples.
Important URLs
- Login/Auth:
https://mcp.alpha.dev/oauth/login - Only for getting authentication token
- Official Website:
https://aiusd.ai - For trading operations, recharge, troubleshooting, and all user interactions
Common Pitfalls and Solutions
Read this before invoking the skill CLI (e.g. when using the installed skill via aiusd-skill or node dist/index.js). These prevent the most frequent failures.
1. CLI parameter passing
- Wrong:
node dist/index.js call genalpha_execute_intent '{"intent": "..."}' (positional JSON)
- Right:
node dist/index.js call genalpha_execute_intent --params '{"intent": "..."}'
- The CLI expects JSON via the
--params flag, not as a positional argument.
2. Passing JSON from code (shell escaping)
- Problem: Complex XML inside JSON is hard to escape correctly in shell.
- Solution: When invoking the CLI from code, use spawn (not
execSync) and pass params as a single string to avoid shell interpretation:
args = ['dist/index.js', 'call', toolName, '--params', JSON.stringify(params)]
spawn('node', args, { stdio: 'pipe' })
3. Intent XML semantics (genalpha_execute_intent)
<buy>: amount = amount of QUOTE token to spend.
<sell>: amount = amount of BASE token to sell.
- AIUSD constraint: AIUSD can only be converted to stablecoins (USDC/USDT/USD1). To buy a non-stable (e.g. SOL): first convert AIUSD→USDC, then USDC→target token.
- Selling AIUSD: use
<buy> with <quote>AIUSD</quote> and <base>USDC_ADDRESS</base> (you are “buying” USDC with AIUSD).
- Buying a token: use
<buy> with <quote>USDC_ADDRESS</quote> and <base>TOKEN_SYMBOL</base>; amount is the USDC amount to spend.
4. Code references (if extending or debugging the skill)
- MCP client: Import
MCPClient (capital C), not McpClient.
- TokenManager: Use
TokenManager.getToken() (static method), not new TokenManager(); tokenManager.getToken().
5. Error handling
- On tool failure, check parameters against the latest
tools --detailed output before retrying. Do not retry with the same payload blindly.
- Always obtain and use the live schema from
tools --detailed; do not rely on static examples in docs.
6. Debugging commands
# Current tool schemas and examples
node dist/index.js tools --detailed
# Or after install: aiusd-skill tools --detailed
# Test connection
node dist/index.js test
# Quick balance check
node dist/index.js balances
# Transaction history
node dist/index.js call genalpha_get_transactions --params '{}'
7. Common error messages
| Message |
Meaning / action |
Missing or invalid 'intent' parameter |
Check JSON structure and that intent is present and valid; compare with tools --detailed. |
insufficient liquidity |
Token may have no/low liquidity on that chain; try another chain or token. |
Jwt is missing / 401 |
Auth issue; run reauth (e.g. npm run reauth or installer’s reauth command). |
Installation Pitfalls and Solutions
For installers and users setting up the skill. Auth setup is the most error-prone step; prefer a one-click reauth script when available.
1. CLI / hub install not finding the skill
2. Security scan warnings
- Possible: VirusTotal / OpenClaw may flag "Suspicious" (e.g. undeclared auth dependencies or installer code).
- Recommendation: Review the code and use an official or trusted source before continuing.
3. Dependency install timeout or failure
4. TypeScript / build failures
5. Auth setup (mcporter, OAuth, ports)
6. OAuth callback / browser not opening
- Problems: Default callback port in use, browser does not open.
- Solutions: Check port usage (e.g.
lsof -i :59589), or run reauth again; if the environment supports it, use a different port via PORT=59589 npm run reauth. Do not give users the login URL; tell them to run reauth again or use the one-click auth script.
7. Auth file locations and full reset
8. Module export name (when extending the skill)
- Problem:
import { McpClient } from '...' fails (no export named McpClient).
- Fix: Use
MCPClient (capital C). See Common Pitfalls §4.
9. Post-install verification
- Problem:
npm test or first tool call fails with "Jwt is missing" or auth errors.
- Checklist:
- Download/unzip (or install via supported method).
npm install (postinstall runs if configured).
npm run build; confirm dist/ exists.
npm run reauth and complete OAuth in the browser.
node dist/index.js balances (or aiusd-skill balances).
node dist/index.js tools --detailed to confirm tool list.
10. Debug and network checks
# Verbose reauth
DEBUG=* npm run reauth
# Reachability
curl -I https://mcp.alpha.dev/api/mcp-hub/mcp
# Check mcporter credential file exists
node -e "console.log(require('fs').existsSync(require('os').homedir() + '/.mcporter/credentials.json'))"
11. Common error codes (install/runtime)
| Code |
Meaning / action |
| ENOTFOUND |
Network/DNS; check connectivity. |
| ECONNREFUSED |
Service unreachable; retry or check URL. |
| ETIMEDOUT |
OAuth or network timeout; retry npm run reauth. |
| Permission denied |
Check file/dir permissions (e.g. ~/.mcporter, ~/.mcp-hub). |
Tool Overview
CRITICAL: Always run aiusd-skill tools --detailed FIRST to get the current live schema and available tools before making any calls. Tool parameters and available tools may change.
| Tool |
Purpose |
Typical user intents |
| genalpha_get_balances |
Query account balances |
balance, how much, account balance |
| genalpha_get_trading_accounts |
Get trading accounts / addresses |
my account, trading account, wallet address |
| genalpha_execute_intent |
Execute trade intent (buy/sell/swap) |
buy, sell, buy SOL with USDC, swap |
| genalpha_stake_aiusd |
Stake AIUSD |
stake, stake AIUSD |
| genalpha_unstake_aiusd |
Unstake |
unstake |
| genalpha_withdraw_to_wallet |
Withdraw to external wallet |
withdraw, transfer out |
| genalpha_ensure_gas |
Top up Gas for on-chain account |
top up gas, ensure gas |
| genalpha_get_transactions |
Query transaction history |
history, recent transactions |
| recharge / top up |
Guide user to recharge account |
recharge, top up, deposit, add funds |
| reauth / login |
Re-authenticate / login |
login, re-login, auth expired, 401 |
NOTE: This list shows commonly available tools. NEW TOOLS may be added. Always check tools --detailed to discover any additional tools that may better serve the user's specific intent.
Tool Reference and Call Usage
MANDATORY: Before calling ANY tool, run aiusd-skill tools --detailed to get current parameters, examples, and any new tools.
genalpha_get_balances
- Purpose: Return user AIUSD custody and staking account balances.
- When to use: User asks for balance, how much, account assets.
- Parameters: Check
tools --detailed for current schema.
genalpha_get_trading_accounts
- Purpose: Return user trading accounts (addresses, etc.) per chain.
- When to use: User asks "my account", "trading account", "wallet address".
- Parameters: Check
tools --detailed for current schema.
genalpha_execute_intent
- Purpose: Execute buy/sell/swap (e.g. buy SOL with USDC, sell ETH).
- When to use: User clearly wants to place order, buy, sell, swap.
- Parameters: Check
tools --detailed for current schema and XML examples.
- IMPORTANT: Intent format may change. Always use examples from live schema.
genalpha_stake_aiusd
- Purpose: Stake AIUSD for yield (e.g. sAIUSD).
- When to use: User says stake, stake AIUSD.
- Parameters: Check
tools --detailed for current schema.
genalpha_unstake_aiusd
- Purpose: Unstake AIUSD (e.g. redeem sAIUSD).
- When to use: User says unstake, redeem.
- Parameters: Check
tools --detailed for current schema.
genalpha_withdraw_to_wallet
- Purpose: Withdraw stablecoin (e.g. USDC) to user-specified external wallet address.
- When to use: User says withdraw, transfer out.
- Parameters: Check
tools --detailed for current schema.
genalpha_ensure_gas
- Purpose: Top up native Gas for user trading account on a given chain.
- When to use: User says top up gas, ensure gas, or chain has low gas.
- Parameters: Check
tools --detailed for current schema.
genalpha_get_transactions
- Purpose: Return user transaction history (list, may include status).
- When to use: User asks history, recent transactions, order status.
- Parameters: Check
tools --detailed for current schema and filtering options.
recharge / top up
- Purpose: Guide user to recharge their AIUSD account with funds.
- When to use: User asks to recharge, top up, deposit, or add funds to their account.
- Response Options:
- Option 1 - Direct deposit: Only USDC stablecoins accepted. Other stablecoins must use official website.
- Option 2 - Official website: https://aiusd.ai (supports all tokens, login with same wallet)
- Important: For direct deposits, only send USDC to the provided addresses. For other stablecoins (USDT, DAI, etc.), user must use the official website.
- Example response: "For recharge, you have two options: 1) Direct USDC deposit to your trading addresses, or 2) Visit https://aiusd.ai for all token types (login with same wallet). Direct deposits only accept USDC - other stablecoins must use the website."
reauth / login (Re-authenticate)
Usage Flow (for Agent Reasoning)
- Get current tools: ALWAYS run
aiusd-skill tools --detailed first to discover all available tools and their current schemas.
- Parse intent: Map natural language to the most appropriate tool. Check if newer tools better match the user's intent.
- Prepare params: Build JSON parameters strictly from the live schema obtained in step 1.
- Call: Invoke the skill's call interface with tool name and params.
- Handle result: Format tool JSON/text for the user; on error, retry or prompt (e.g. auth expired → prompt re-login).
CRITICAL: Never use parameter examples from this documentation. Always use the live schema from tools --detailed.
Auth and Error Handling
Auth error auto-fix
On auth-related errors, Claude should run re-auth:
- 401 Unauthorized → run
npm run reauth
- Session ID is required → run
npm run reauth
- Token invalid or expired → run
npm run reauth
- Auth failed → run
npm run reauth
Error handling flow
- Detect auth error → run
npm run reauth
- Business error → relay server error to user; do not invent causes
- Network/timeout → retry once; then ask user to check network or try later
- Trading issues/failures → direct user to official website https://aiusd.ai for manual operations and support
Sample error dialogues
Auth Error
User: "Check balance"
[Tool returns 401]
Claude: Auth expired; re-authenticating...
[Run: npm run reauth]
Claude: Re-auth done. Fetching balance...
[Call: genalpha_get_balances]
Trading Error
User: "Buy 100 USDC worth of SOL"
[Tool returns trading error]
Claude: I encountered an issue with the trade execution. For manual trading operations, please visit https://aiusd.ai and use the same wallet you use for authentication.
Getting Current Tools and Schema
MANDATORY FIRST STEP: Before performing any user task, run:
aiusd-skill tools --detailed
This command returns:
- Complete list of available tools (may include new tools not listed in this document)
- Current parameter schemas for all tools
- Working examples and proper formatting
- Any tool-specific instructions or constraints
Why this is critical:
- Tools may be added, modified, or deprecated
- Parameter formats can change
- New tools may better serve specific user intents
- Examples in this document may become outdated
Always base your tool calls on the live output from tools --detailed, not on static examples in this documentation.
1---2name: aiusd-skill-23description: AIUSD trading and account management skill for cryptocurrency trading and account management.4license: MIT5---67# AIUSD Skill (Agent Reference)89This skill calls the AIUSD backend via MCP. Auth is resolved in order: env `MCP_HUB_TOKEN`, mcporter OAuth, or local `~/.mcp-hub/token.json`. Ensure a valid Bearer token is available before calling. **Before invoking the CLI**, read **Common Pitfalls and Solutions** to avoid parameter, escaping, and intent mistakes.1011## ⚠️ Agent Output Guidelines1213**CRITICAL - ABSOLUTELY FORBIDDEN PHRASES**:14Agents must NEVER use these words or phrases when responding to users:1516**TEMPLATE-RELATED (COMPLETELY BANNED)**:17- "template" (any form: template, templates)18- "example" (when referring to trading examples: Example 1, Example 12, etc.)19- "pattern" (when referring to trading patterns)20- "using template", "get template", "trading template", "buy template"21- "use Example [number]", "based on template", "following template"2223**VERIFICATION-RELATED (COMPLETELY BANNED)**:24- "skill verification", "verification"2526**WHAT TO SAY INSTEAD**:27- Instead of "using template": say "executing the trade" or "placing the order"28- Instead of "get template": say "preparing the trade" or "setting up the order"29- Instead of "Example 12 template": say "the trade configuration" or simply describe the action3031**ZERO TOLERANCE**: Any use of the word "template" in trading contexts is STRICTLY PROHIBITED.3233**Authentication Response Guidelines**:34**CRITICAL**: When users request re-authentication, respond ONLY with:35- "The browser window should have opened for you"36- "If it didn't open automatically, please tell the agent to re-login again (or type 'reauth' again)"37- "After completing authentication, you can check your account balance or wallet status in chat"3839**NEVER return the login URL to the user**: Do NOT ever show or tell the user `https://mcp.alpha.dev/oauth/login`. If the browser did not open, do NOT give them the URL—only tell them to ask the agent to re-login / type 'reauth' again.4041**STRICTLY FORBIDDEN**:42- Do NOT include or mention the login URL (e.g. mcp.alpha.dev/oauth/login) in your response to the user43- Do NOT include numbered steps like "1. Open page: [URL]", "2. Connect wallet", etc.44- Do NOT mention any specific auth/login URLs in the response45- Do NOT say "waiting for authentication completion" or similar waiting phrases46- Do NOT provide detailed step-by-step browser instructions47- Do NOT create bulleted lists of authentication steps48- Do NOT say phrases like "browser has been opened for you", "please complete the following steps in browser"49- Simply guide them to the browser and, if it didn't open, only say to re-login / type reauth again5051Use natural, direct language to describe trading operations and system status. Simply describe what the trade will do without referencing templates or examples.5253## Important URLs5455- **Login/Auth**: `https://mcp.alpha.dev/oauth/login` - Only for getting authentication token56- **Official Website**: `https://aiusd.ai` - For trading operations, recharge, troubleshooting, and all user interactions5758## Common Pitfalls and Solutions5960**Read this before invoking the skill CLI** (e.g. when using the installed skill via `aiusd-skill` or `node dist/index.js`). These prevent the most frequent failures.6162### 1. CLI parameter passing6364- **Wrong**: `node dist/index.js call genalpha_execute_intent '{"intent": "..."}'` (positional JSON)65- **Right**: `node dist/index.js call genalpha_execute_intent --params '{"intent": "..."}'`66- The CLI expects JSON via the **`--params`** flag, not as a positional argument.6768### 2. Passing JSON from code (shell escaping)6970- **Problem**: Complex XML inside JSON is hard to escape correctly in shell.71- **Solution**: When invoking the CLI from code, use **spawn** (not `execSync`) and pass params as a single string to avoid shell interpretation:72 - `args = ['dist/index.js', 'call', toolName, '--params', JSON.stringify(params)]`73 - `spawn('node', args, { stdio: 'pipe' })`7475### 3. Intent XML semantics (`genalpha_execute_intent`)7677- **`<buy>`**: `amount` = amount of **QUOTE** token to spend.78- **`<sell>`**: `amount` = amount of **BASE** token to sell.79- **AIUSD constraint**: AIUSD can only be converted to stablecoins (USDC/USDT/USD1). To buy a non-stable (e.g. SOL): first convert AIUSD→USDC, then USDC→target token.80- **Selling AIUSD**: use `<buy>` with `<quote>AIUSD</quote>` and `<base>USDC_ADDRESS</base>` (you are “buying” USDC with AIUSD).81- **Buying a token**: use `<buy>` with `<quote>USDC_ADDRESS</quote>` and `<base>TOKEN_SYMBOL</base>`; `amount` is the USDC amount to spend.8283### 4. Code references (if extending or debugging the skill)8485- **MCP client**: Import **`MCPClient`** (capital C), not `McpClient`.86- **TokenManager**: Use **`TokenManager.getToken()`** (static method), not `new TokenManager(); tokenManager.getToken()`.8788### 5. Error handling8990- On tool failure, **check parameters against the latest `tools --detailed` output** before retrying. Do not retry with the same payload blindly.91- Always obtain and use the live schema from `tools --detailed`; do not rely on static examples in docs.9293### 6. Debugging commands9495```bash96# Current tool schemas and examples97node dist/index.js tools --detailed98# Or after install: aiusd-skill tools --detailed99100# Test connection101node dist/index.js test102103# Quick balance check104node dist/index.js balances105106# Transaction history107node dist/index.js call genalpha_get_transactions --params '{}'108```109110### 7. Common error messages111112| Message | Meaning / action |113|--------|-------------------|114| `Missing or invalid 'intent' parameter` | Check JSON structure and that `intent` is present and valid; compare with `tools --detailed`. |115| `insufficient liquidity` | Token may have no/low liquidity on that chain; try another chain or token. |116| `Jwt is missing` / 401 | Auth issue; run reauth (e.g. `npm run reauth` or installer’s reauth command). |117118## Installation Pitfalls and Solutions119120**For installers and users setting up the skill.** Auth setup is the most error-prone step; prefer a one-click reauth script when available.121122### 1. CLI / hub install not finding the skill123124- **Problem**: `clawdbot install aiusd-skill-agent` or install by repo path reports "Skill not found".125- **Workaround**: Manual download, then unzip:126 ```bash127 curl -L "https://auth.clawdhub.com/api/v1/download?slug=aiusd-skill-agent" -o aiusd-skill.zip128 unzip aiusd-skill.zip129 ```130131### 2. Security scan warnings132133- **Possible**: VirusTotal / OpenClaw may flag "Suspicious" (e.g. undeclared auth dependencies or installer code).134- **Recommendation**: Review the code and use an official or trusted source before continuing.135136### 3. Dependency install timeout or failure137138- **Problem**: `npm install` times out or fails (network, conflicts).139- **Solution**:140 ```bash141 rm -rf node_modules package-lock.json142 npm cache clean --force143 npm install144 ```145146### 4. TypeScript / build failures147148- **Problem**: Build errors such as "Cannot find module 'commander'" or "Cannot find name 'process'".149- **Solution**: Install full dev dependencies and Node types:150 ```bash151 npm install --include=dev152 # or153 npm install @types/node --save-dev154 ```155156### 5. Auth setup (mcporter, OAuth, ports)157158- **Problems**: mcporter config, OAuth timeout, or port conflicts.159- **Recommended flow**: Install → build → ensure mcporter → run reauth once:160 ```bash161 cd aiusd-skill162 npm install && npm run build163 which mcporter || npm install -g mcporter164 npm run reauth165 ```166 Or: `npx mcporter auth https://mcp.alpha.dev/api/mcp-hub/mcp`. Prefer the project’s **one-click reauth script** when provided.167168### 6. OAuth callback / browser not opening169170- **Problems**: Default callback port in use, browser does not open.171- **Solutions**: Check port usage (e.g. `lsof -i :59589`), or run reauth again; if the environment supports it, use a different port via `PORT=59589 npm run reauth`. Do **not** give users the login URL; tell them to run reauth again or use the one-click auth script.172173### 7. Auth file locations and full reset174175- **Auth state** may live in: `~/.mcporter/credentials.json`, `~/.mcp-hub/token.json`, or env `MCP_HUB_TOKEN`.176- **Full auth reset**:177 ```bash178 rm -rf ~/.mcporter ~/.mcp-hub179 unset MCP_HUB_TOKEN180 npm run reauth181 ```182183### 8. Module export name (when extending the skill)184185- **Problem**: `import { McpClient } from '...'` fails (no export named `McpClient`).186- **Fix**: Use **`MCPClient`** (capital C). See Common Pitfalls §4.187188### 9. Post-install verification189190- **Problem**: `npm test` or first tool call fails with "Jwt is missing" or auth errors.191- **Checklist**:192 1. Download/unzip (or install via supported method).193 2. `npm install` (postinstall runs if configured).194 3. `npm run build`; confirm `dist/` exists.195 4. `npm run reauth` and complete OAuth in the browser.196 5. `node dist/index.js balances` (or `aiusd-skill balances`).197 6. `node dist/index.js tools --detailed` to confirm tool list.198199### 10. Debug and network checks200201```bash202# Verbose reauth203DEBUG=* npm run reauth204205# Reachability206curl -I https://mcp.alpha.dev/api/mcp-hub/mcp207208# Check mcporter credential file exists209node -e "console.log(require('fs').existsSync(require('os').homedir() + '/.mcporter/credentials.json'))"210```211212### 11. Common error codes (install/runtime)213214| Code | Meaning / action |215|------|-------------------|216| ENOTFOUND | Network/DNS; check connectivity. |217| ECONNREFUSED | Service unreachable; retry or check URL. |218| ETIMEDOUT | OAuth or network timeout; retry `npm run reauth`. |219| Permission denied | Check file/dir permissions (e.g. `~/.mcporter`, `~/.mcp-hub`). |220221## Tool Overview222223**CRITICAL**: Always run `aiusd-skill tools --detailed` FIRST to get the current live schema and available tools before making any calls. Tool parameters and available tools may change.224225| Tool | Purpose | Typical user intents |226|------|---------|----------------------|227| genalpha_get_balances | Query account balances | balance, how much, account balance |228| genalpha_get_trading_accounts | Get trading accounts / addresses | my account, trading account, wallet address |229| genalpha_execute_intent | Execute trade intent (buy/sell/swap) | buy, sell, buy SOL with USDC, swap |230| genalpha_stake_aiusd | Stake AIUSD | stake, stake AIUSD |231| genalpha_unstake_aiusd | Unstake | unstake |232| genalpha_withdraw_to_wallet | Withdraw to external wallet | withdraw, transfer out |233| genalpha_ensure_gas | Top up Gas for on-chain account | top up gas, ensure gas |234| genalpha_get_transactions | Query transaction history | history, recent transactions |235| recharge / top up | Guide user to recharge account | recharge, top up, deposit, add funds |236| reauth / login | Re-authenticate / login | login, re-login, auth expired, 401 |237238**NOTE**: This list shows commonly available tools. NEW TOOLS may be added. Always check `tools --detailed` to discover any additional tools that may better serve the user's specific intent.239240## Tool Reference and Call Usage241242**MANDATORY**: Before calling ANY tool, run `aiusd-skill tools --detailed` to get current parameters, examples, and any new tools.243244### genalpha_get_balances245246- **Purpose**: Return user AIUSD custody and staking account balances.247- **When to use**: User asks for balance, how much, account assets.248- **Parameters**: Check `tools --detailed` for current schema.249250### genalpha_get_trading_accounts251252- **Purpose**: Return user trading accounts (addresses, etc.) per chain.253- **When to use**: User asks "my account", "trading account", "wallet address".254- **Parameters**: Check `tools --detailed` for current schema.255256### genalpha_execute_intent257258- **Purpose**: Execute buy/sell/swap (e.g. buy SOL with USDC, sell ETH).259- **When to use**: User clearly wants to place order, buy, sell, swap.260- **Parameters**: Check `tools --detailed` for current schema and XML examples.261- **IMPORTANT**: Intent format may change. Always use examples from live schema.262263### genalpha_stake_aiusd264265- **Purpose**: Stake AIUSD for yield (e.g. sAIUSD).266- **When to use**: User says stake, stake AIUSD.267- **Parameters**: Check `tools --detailed` for current schema.268269### genalpha_unstake_aiusd270271- **Purpose**: Unstake AIUSD (e.g. redeem sAIUSD).272- **When to use**: User says unstake, redeem.273- **Parameters**: Check `tools --detailed` for current schema.274275### genalpha_withdraw_to_wallet276277- **Purpose**: Withdraw stablecoin (e.g. USDC) to user-specified external wallet address.278- **When to use**: User says withdraw, transfer out.279- **Parameters**: Check `tools --detailed` for current schema.280281### genalpha_ensure_gas282283- **Purpose**: Top up native Gas for user trading account on a given chain.284- **When to use**: User says top up gas, ensure gas, or chain has low gas.285- **Parameters**: Check `tools --detailed` for current schema.286287### genalpha_get_transactions288289- **Purpose**: Return user transaction history (list, may include status).290- **When to use**: User asks history, recent transactions, order status.291- **Parameters**: Check `tools --detailed` for current schema and filtering options.292293### recharge / top up294295- **Purpose**: Guide user to recharge their AIUSD account with funds.296- **When to use**: User asks to recharge, top up, deposit, or add funds to their account.297- **Response Options**:298 - **Option 1 - Direct deposit**: Only USDC stablecoins accepted. Other stablecoins must use official website.299 - **Option 2 - Official website**: https://aiusd.ai (supports all tokens, login with same wallet)300- **Important**: For direct deposits, only send USDC to the provided addresses. For other stablecoins (USDT, DAI, etc.), user must use the official website.301- **Example response**: "For recharge, you have two options: 1) Direct USDC deposit to your trading addresses, or 2) Visit https://aiusd.ai for all token types (login with same wallet). Direct deposits only accept USDC - other stablecoins must use the website."302303### reauth / login (Re-authenticate)304305- **Purpose**: Clear all cached auth and run OAuth login again.306- **When to use**: User has 401 Unauthorized, "Session ID is required", token expired, auth failure, user asks to re-login, or switch account.307- **Params**: None. Pass `{}`.308- **Example**:309 - `npm run reauth`310 - `npm run login`311 - `node scripts/reauth.js`312- **Steps**:313 1. Clear mcporter cache (`~/.mcporter/`)314 2. Clear local token file (`~/.mcp-hub/`)315 3. Clear other auth cache files316 4. Start browser OAuth login317 5. Verify new auth works318- **Sample dialogue**:319 ```320 User: "I'm getting 401"321 Claude: Looks like an auth issue; re-authenticating...322 [Run: npm run reauth]323 Claude: Re-auth done; you can use the skill again.324325 User: "Re-login"326 Claude: Clearing cache and re-logging in...327 [Run: npm run login]328 ```329330## Usage Flow (for Agent Reasoning)3313321. **Get current tools**: ALWAYS run `aiusd-skill tools --detailed` first to discover all available tools and their current schemas.3332. **Parse intent**: Map natural language to the most appropriate tool. Check if newer tools better match the user's intent.3343. **Prepare params**: Build JSON parameters strictly from the live schema obtained in step 1.3354. **Call**: Invoke the skill's call interface with tool name and params.3365. **Handle result**: Format tool JSON/text for the user; on error, retry or prompt (e.g. auth expired → prompt re-login).337338**CRITICAL**: Never use parameter examples from this documentation. Always use the live schema from `tools --detailed`.339340## Auth and Error Handling341342### Auth error auto-fix343344On auth-related errors, Claude should run re-auth:345346- **401 Unauthorized** → run `npm run reauth`347- **Session ID is required** → run `npm run reauth`348- **Token invalid or expired** → run `npm run reauth`349- **Auth failed** → run `npm run reauth`350351### Error handling flow3523531. **Detect auth error** → run `npm run reauth`3542. **Business error** → relay server error to user; do not invent causes3553. **Network/timeout** → retry once; then ask user to check network or try later3564. **Trading issues/failures** → direct user to official website https://aiusd.ai for manual operations and support357358### Sample error dialogues359360#### Auth Error361```362User: "Check balance"363[Tool returns 401]364Claude: Auth expired; re-authenticating...365[Run: npm run reauth]366Claude: Re-auth done. Fetching balance...367[Call: genalpha_get_balances]368```369370#### Trading Error371```372User: "Buy 100 USDC worth of SOL"373[Tool returns trading error]374Claude: I encountered an issue with the trade execution. For manual trading operations, please visit https://aiusd.ai and use the same wallet you use for authentication.375```376377## Getting Current Tools and Schema378379**MANDATORY FIRST STEP**: Before performing any user task, run:380381```bash382aiusd-skill tools --detailed383```384385This command returns:3861. **Complete list of available tools** (may include new tools not listed in this document)3872. **Current parameter schemas** for all tools3883. **Working examples** and proper formatting3894. **Any tool-specific instructions** or constraints390391**Why this is critical**:392- Tools may be added, modified, or deprecated393- Parameter formats can change394- New tools may better serve specific user intents395- Examples in this document may become outdated396397Always base your tool calls on the live output from `tools --detailed`, not on static examples in this documentation.