Skip to main content
Glama

get_wallet_info

Retrieve wallet details including chain, address, environment, and available networks for crypto operations.

Instructions

Get wallet info including chain, address, environment, and available networks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wallet_idNoTarget wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.

Implementation Reference

  • The asynchronous handler function that performs the API calls and combines the data to return the wallet information.
    async (args) => {
      const params = new URLSearchParams();
      if (args.wallet_id) params.set('walletId', args.wallet_id);
      const qs = params.toString();
      const addressResult = await apiClient.get<Record<string, unknown>>('/v1/wallet/address' + (qs ? '?' + qs : ''));
      if (!addressResult.ok) {
        return toToolResult(addressResult);
      }
    
      const walletId = addressResult.data['walletId'] as string;
      const networksResult = await apiClient.get<{ networks: unknown[] }>(
        '/v1/wallets/' + walletId + '/networks',
      );
    
      // Fetch wallet detail to get smart account fields (accountType, signerKey, deployed)
      const detailResult = await apiClient.get<Record<string, unknown>>(
        '/v1/wallets/' + walletId,
      );
    
      const combined = {
        ...addressResult.data,
        networks: networksResult.ok ? networksResult.data.networks : [],
        accountType: detailResult.ok ? (detailResult.data['accountType'] ?? 'eoa') : 'eoa',
        signerKey: detailResult.ok ? (detailResult.data['signerKey'] ?? null) : null,
        deployed: detailResult.ok ? (detailResult.data['deployed'] ?? true) : true,
      };
    
      return {
        content: [{ type: 'text' as const, text: JSON.stringify(combined) }],
      };
    },
  • The registration function that defines the 'get_wallet_info' tool within the MCP server.
    export function registerGetWalletInfo(server: McpServer, apiClient: ApiClient, walletContext?: WalletContext): void {
      server.tool(
        'get_wallet_info',
        withWalletPrefix('Get wallet info including chain, address, environment, and available networks.', walletContext?.walletName),
        {
          wallet_id: z.string().optional().describe('Target wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.'),
        },
        async (args) => {
          const params = new URLSearchParams();
          if (args.wallet_id) params.set('walletId', args.wallet_id);
          const qs = params.toString();
          const addressResult = await apiClient.get<Record<string, unknown>>('/v1/wallet/address' + (qs ? '?' + qs : ''));
          if (!addressResult.ok) {
            return toToolResult(addressResult);
          }
    
          const walletId = addressResult.data['walletId'] as string;
          const networksResult = await apiClient.get<{ networks: unknown[] }>(
            '/v1/wallets/' + walletId + '/networks',
          );
    
          // Fetch wallet detail to get smart account fields (accountType, signerKey, deployed)
          const detailResult = await apiClient.get<Record<string, unknown>>(
            '/v1/wallets/' + walletId,
          );
    
          const combined = {
            ...addressResult.data,
            networks: networksResult.ok ? networksResult.data.networks : [],
            accountType: detailResult.ok ? (detailResult.data['accountType'] ?? 'eoa') : 'eoa',
            signerKey: detailResult.ok ? (detailResult.data['signerKey'] ?? null) : null,
            deployed: detailResult.ok ? (detailResult.data['deployed'] ?? true) : true,
          };
    
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(combined) }],
          };
        },
      );

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/minhoyoo-iotrust/WAIaaS'

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