get_cosmos_delegations
Retrieve staking delegation details for a Cosmos blockchain address to monitor validator allocations and network participation.
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
- Input schema and metadata for the 'get_cosmos_delegations' tool{ 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'], }, },
- src/handlers/cosmos-handlers.ts:440-456 (handler)Execution handler in handleCosmosTool that parses input arguments, calls the service method, and formats the responsecase '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, }; }
- Core service method implementing the tool logic by querying the Cosmos REST API for delegationsasync 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', }; } }