get_cosmos_validators
Retrieve validator lists for Cosmos blockchains with status filtering to monitor network participation and security.
Instructions
Get list of validators on a Cosmos chain
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name | |
| status | No | Validator status filter (defaults to bonded) | |
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- src/handlers/cosmos-handlers.ts:458-474 (handler)MCP tool handler logic that parses input arguments and delegates to CosmosService.getValidators for executioncase 'get_cosmos_validators': { const blockchain = args?.blockchain as string; const status = (args?.status as 'bonded' | 'unbonded' | 'unbonding' | 'all') || 'bonded'; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await cosmosService.getValidators(blockchain, status, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- Core implementation that constructs the Cosmos Staking REST API endpoint for validators and performs the HTTP fetchasync getValidators( blockchain: string, status: 'bonded' | 'unbonded' | 'unbonding' | 'all' = 'bonded', network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { try { const baseUrl = this.getRestUrl(blockchain, network); const statusFilter = status === 'all' ? '' : `?status=${status.toUpperCase()}`; const url = `${baseUrl}/cosmos/staking/v1beta1/validators${statusFilter}`; return this.fetchRest(url); } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get Cosmos validators', }; } }
- Tool schema definition including input parameters, types, and descriptions for validation and documentation{ name: 'get_cosmos_validators', description: 'Get list of validators on a Cosmos chain', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, status: { type: 'string', enum: ['bonded', 'unbonded', 'unbonding', 'all'], description: 'Validator status filter (defaults to bonded)', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain'], }, },
- src/index.ts:98-98 (registration)Registers all Cosmos tools, including get_cosmos_validators, with the MCP server instance...registerCosmosHandlers(server, cosmosService),