Skip to main content
Glama
solanaprox

solanaprox-mcp

by solanaprox

check_balance

Check available USDC and SOL balances for AI requests on SolanaProx using your wallet address.

Instructions

Check your current SolanaProx balance. Returns available USDC and SOL balance that can be used for AI requests.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletNoSolana wallet address to check. Defaults to configured wallet.

Implementation Reference

  • The handler function that executes the check_balance tool logic. Extracts the wallet parameter from args, calls the getBalance helper function, and returns formatted balance information including USDC and SOL values.
    case "check_balance": {
      const { wallet } = args as any;
      const balance = await getBalance(wallet);
    
      return {
        content: [
          {
            type: "text",
            text: [
              `💰 SolanaProx Balance`,
              `Wallet: ${balance.wallet || WALLET_ADDRESS}`,
              `Total: $${balance.total_usd?.toFixed(4)} USD`,
              `USDC: $${balance.usdc?.toFixed(4)}`,
              `SOL value: $${balance.sol_usd?.toFixed(4)}`,
              ``,
              balance.total_usd > 0
                ? `✅ Ready to make AI requests`
                : `⚠️  No balance. Deposit USDC at ${SOLANAPROX_URL}`,
            ].join("\n"),
          },
        ],
      };
    }
  • Tool registration and schema definition for check_balance. Defines the tool name, description, and inputSchema with an optional wallet parameter for specifying which Solana wallet address to check.
    {
      name: "check_balance",
      description:
        "Check your current SolanaProx balance. Returns available USDC and SOL balance that can be used for AI requests.",
      inputSchema: {
        type: "object",
        properties: {
          wallet: {
            type: "string",
            description:
              "Solana wallet address to check. Defaults to configured wallet.",
          },
        },
        required: [],
      },
    },
  • Helper function getBalance() that makes the actual API call to fetch wallet balance from SolanaProx. Accepts an optional wallet parameter, constructs the API endpoint URL, and returns balance data including total_usd, usdc, sol_usd, and wallet address.
    async function getBalance(wallet?: string): Promise<{
      total_usd: number;
      usdc: number;
      sol_usd: number;
      wallet: string;
    }> {
      const targetWallet = wallet || WALLET_ADDRESS;
      const res = await fetch(
        `${SOLANAPROX_URL}/api/balance/${targetWallet}`
      );
    
      if (!res.ok) {
        throw new Error(`Failed to fetch balance: ${res.statusText}`);
      }
    
      return res.json() as any;
    }
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/solanaprox/mcp-server'

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