get_balance
Check your VirtualSMS account balance in USD to monitor SMS verification service credits. Requires VIRTUALSMS_API_KEY to be set.
Instructions
Check your VirtualSMS account balance in USD. Requires VIRTUALSMS_API_KEY to be set.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| currency | No | Display balance in specific currency (default: USD) |
Implementation Reference
- src/tools.ts:452-460 (handler)The handler function 'handleGetBalance' which executes the tool logic by calling the client's getBalance method.
export async function handleGetBalance(client: VirtualSMSClient) { const balance = await client.getBalance(); return { content: [ { type: 'text' as const, text: JSON.stringify(balance, null, 2), }, ], - src/tools.ts:133-148 (registration)Definition and registration of the 'get_balance' tool.
name: 'get_balance', title: 'Get Account Balance', description: 'Check your VirtualSMS account balance in USD. ' + 'Requires VIRTUALSMS_API_KEY to be set.', inputSchema: { type: 'object' as const, properties: { currency: { type: 'string', description: 'Display balance in specific currency (default: USD)', }, }, required: [], }, annotations: { - src/client.ts:135-142 (helper)The underlying API client method that performs the actual network request to fetch the account balance.
async getBalance(): Promise<Balance> { this.requireApiKey(); const res = await this.http.get('/api/v1/customer/balance'); const raw = res.data as Record<string, unknown>; return { balance_usd: Number(raw.balance_usd ?? raw.balance ?? 0), }; }