get_cosmos_all_balances
Retrieve all token balances for a Cosmos SDK address across multiple blockchains using Grove's MCP Server for Pocket Network.
Instructions
Get all token balances for a Cosmos SDK address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name (e.g., "osmosis", "juno", "kava") | |
| address | Yes | Cosmos address | |
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- src/handlers/cosmos-handlers.ts:404-420 (handler)MCP tool handler case that parses input arguments, calls the service method, and formats the response.case 'get_cosmos_all_balances': { const blockchain = args?.blockchain as string; const address = args?.address as string; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await cosmosService.getAllBalances(blockchain, address, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- src/handlers/cosmos-handlers.ts:42-64 (registration)Tool registration definition including name, description, and input schema used by registerCosmosHandlers.{ name: 'get_cosmos_all_balances', description: 'Get all token balances for a Cosmos SDK address', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name (e.g., "osmosis", "juno", "kava")', }, address: { type: 'string', description: 'Cosmos address', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'address'], }, },
- Service method implementing the core logic: constructs Cosmos REST API URL for all balances and fetches data.async getAllBalances( blockchain: string, address: string, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { try { const baseUrl = this.getRestUrl(blockchain, network); const url = `${baseUrl}/cosmos/bank/v1beta1/balances/${address}`; return this.fetchRest(url); } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get Cosmos balances', }; } }