get_user_balance
Retrieve current DeepSeek account balance and availability status for account health checks and provider-side failure diagnosis.
Instructions
Return the current DeepSeek account balance and availability status. This tool takes no parameters and is read-only. Use it for account health checks when diagnosing provider-side failures.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp-server.ts:364-389 (handler)The MCP tool handler for 'get_user_balance'. It calls options.client.getUserBalance() and returns the balance as JSON stringified text and structured content.
server.registerTool( "get_user_balance", { description: "Return the current DeepSeek account balance and availability status. This tool takes no parameters and is read-only. Use it for account health checks when diagnosing provider-side failures.", inputSchema: emptyToolInputSchema, annotations: { readOnlyHint: true, }, }, async () => { try { const balance = await options.client.getUserBalance(); return { content: [ { type: "text", text: JSON.stringify(balance, null, 2), }, ], structuredContent: balance as unknown as Record<string, unknown>, }; } catch (error) { return makeToolErrorResult(error); } }, - src/deepseek/schemas.ts:59-59 (schema)The input schema for the get_user_balance tool. Uses emptyToolInputSchema (z.object({})) since the tool takes no parameters.
export const emptyToolInputSchema = z.object({}); - src/mcp-server.ts:47-51 (registration)Endpoint mapping entry in ENDPOINT_MATRIX that maps the tool name 'get_user_balance' to the API endpoint '/user/balance' with method GET.
endpoint: "/user/balance", method: "GET", tool: "get_user_balance", description: "Retrieve account balance", }, - src/deepseek/client.ts:137-143 (helper)The API client method getUserBalance() that makes a GET request to /user/balance and returns the parsed DeepSeekUserBalanceResponse.
async getUserBalance(): Promise<DeepSeekUserBalanceResponse> { return this.requestJson<DeepSeekUserBalanceResponse>({ method: "GET", path: "/user/balance", stream: false, }); } - src/deepseek/types.ts:161-171 (schema)Type definitions for DeepSeekUserBalanceResponse and DeepSeekBalanceInfo describing the response shape (is_available, balance_infos with currency/balances).
export interface DeepSeekBalanceInfo { currency: string; total_balance: string; granted_balance: string; topped_up_balance: string; } export interface DeepSeekUserBalanceResponse { is_available: boolean; balance_infos: DeepSeekBalanceInfo[]; }