Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

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
NameRequiredDescriptionDefault
blockchainYesBlockchain name
statusNoValidator status filter (defaults to bonded)
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • MCP tool handler logic that parses input arguments and delegates to CosmosService.getValidators for execution
    case '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 fetch
    async 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),

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/buildwithgrove/mcp-pocket'

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