Skip to main content
Glama

get_user_balance

Read-only

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

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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);
        }
      },
  • The input schema for the get_user_balance tool. Uses emptyToolInputSchema (z.object({})) since the tool takes no parameters.
    export const emptyToolInputSchema = z.object({});
  • 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",
    },
  • 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,
      });
    }
  • 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[];
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description reinforces read-only nature and no parameters; annotations already provide readOnlyHint, but description adds 'availability status' and health check context, which is beneficial.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no redundancy, front-loaded with purpose, every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Complete for a simple no-parameter read-only tool with no output schema; covers purpose, parameters, usage context, and behavioral safety.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Description explicitly states 'takes no parameters', adding clarity beyond the empty input schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States verb 'Return' and specific resources 'DeepSeek account balance and availability status'. Clearly distinguishes from sibling tools that handle completions or conversations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly advises use for 'account health checks when diagnosing provider-side failures', providing clear context and when-not scenario.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DMontgomery40/deepseek-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server