get_cosmos_delegations
Retrieve all staking delegations for a Cosmos blockchain address to monitor validator positions and delegation amounts across networks.
Instructions
Get all staking delegations for a Cosmos address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name | |
| delegatorAddress | Yes | Delegator address | |
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- src/services/cosmos-service.ts:143-159 (handler)Core handler implementation: fetches staking delegations for a delegator address using Cosmos SDK REST API endpoint /cosmos/staking/v1beta1/delegations/{address}async getDelegations( blockchain: string, delegatorAddress: string, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { try { const baseUrl = this.getRestUrl(blockchain, network); const url = `${baseUrl}/cosmos/staking/v1beta1/delegations/${delegatorAddress}`; return this.fetchRest(url); } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get Cosmos delegations', }; } }
- src/handlers/cosmos-handlers.ts:440-456 (handler)Tool dispatch handler: extracts parameters from tool args and calls CosmosService.getDelegations, formats response for MCPcase 'get_cosmos_delegations': { const blockchain = args?.blockchain as string; const delegatorAddress = args?.delegatorAddress as string; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await cosmosService.getDelegations(blockchain, delegatorAddress, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- Tool schema definition: specifies name, description, input parameters (blockchain, delegatorAddress, optional network), used for registration and validation{ name: 'get_cosmos_delegations', description: 'Get all staking delegations for a Cosmos address', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, delegatorAddress: { type: 'string', description: 'Delegator address', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'delegatorAddress'], }, },