Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_cosmos_rewards

Retrieve staking rewards for Cosmos delegators by specifying blockchain, delegator address, and optional validator. Supports mainnet and testnet networks.

Instructions

Get staking rewards for a delegator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockchainYesBlockchain name
delegatorAddressYesDelegator address
validatorAddressNoOptional: Specific validator address
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • Input schema and tool metadata definition for 'get_cosmos_rewards' tool.
    {
      name: 'get_cosmos_rewards',
      description: 'Get staking rewards for a delegator',
      inputSchema: {
        type: 'object',
        properties: {
          blockchain: {
            type: 'string',
            description: 'Blockchain name',
          },
          delegatorAddress: {
            type: 'string',
            description: 'Delegator address',
          },
          validatorAddress: {
            type: 'string',
            description: 'Optional: Specific validator address',
          },
          network: {
            type: 'string',
            enum: ['mainnet', 'testnet'],
            description: 'Network type (defaults to mainnet)',
          },
        },
        required: ['blockchain', 'delegatorAddress'],
      },
    },
  • MCP tool handler case for 'get_cosmos_rewards': extracts args, calls service, returns formatted response.
    case 'get_cosmos_rewards': {
      const blockchain = args?.blockchain as string;
      const delegatorAddress = args?.delegatorAddress as string;
      const validatorAddress = args?.validatorAddress as string | undefined;
      const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet';
    
      const result = await cosmosService.getRewards(
        blockchain,
        delegatorAddress,
        validatorAddress,
        network
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
        isError: !result.success,
      };
    }
  • Core helper method: Builds and fetches Cosmos REST API endpoint for delegator rewards.
    async getRewards(
      blockchain: string,
      delegatorAddress: string,
      validatorAddress?: string,
      network: 'mainnet' | 'testnet' = 'mainnet'
    ): Promise<EndpointResponse> {
      try {
        const baseUrl = this.getRestUrl(blockchain, network);
        const url = validatorAddress
          ? `${baseUrl}/cosmos/distribution/v1beta1/delegators/${delegatorAddress}/rewards/${validatorAddress}`
          : `${baseUrl}/cosmos/distribution/v1beta1/delegators/${delegatorAddress}/rewards`;
    
        return this.fetchRest(url);
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Failed to get Cosmos rewards',
        };
      }
    }
  • Function that defines and returns all Cosmos tools array for registration with MCP server, including 'get_cosmos_rewards'.
    export function registerCosmosHandlers(
      server: Server,
      cosmosService: CosmosService
    ): Tool[] {
      const tools: Tool[] = [
        {
          name: 'get_cosmos_balance',
          description: 'Get balance for a Cosmos SDK address on any Cosmos chain',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name (e.g., "osmosis", "juno", "kava", "akash")',
              },
              address: {
                type: 'string',
                description: 'Cosmos address',
              },
              denom: {
                type: 'string',
                description: 'Optional: Specific denomination to query (e.g., "uosmo", "ujuno")',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'address'],
          },
        },
        {
          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'],
          },
        },
        {
          name: 'get_cosmos_account',
          description: 'Get Cosmos account information (sequence, account number)',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              address: {
                type: 'string',
                description: 'Cosmos address',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'address'],
          },
        },
        {
          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'],
          },
        },
        {
          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'],
          },
        },
        {
          name: 'get_cosmos_validator',
          description: 'Get specific validator details',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              validatorAddress: {
                type: 'string',
                description: 'Validator address',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'validatorAddress'],
          },
        },
        {
          name: 'get_cosmos_rewards',
          description: 'Get staking rewards for a delegator',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              delegatorAddress: {
                type: 'string',
                description: 'Delegator address',
              },
              validatorAddress: {
                type: 'string',
                description: 'Optional: Specific validator address',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'delegatorAddress'],
          },
        },
        {
          name: 'get_cosmos_transaction',
          description: 'Get Cosmos transaction by hash',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              txHash: {
                type: 'string',
                description: 'Transaction hash',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'txHash'],
          },
        },
        {
          name: 'search_cosmos_transactions',
          description: 'Search Cosmos transactions by events',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              events: {
                type: 'array',
                items: { type: 'string' },
                description: 'Event filters (e.g., ["message.sender=cosmos1...", "transfer.amount=1000uosmo"])',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'events'],
          },
        },
        {
          name: 'get_cosmos_proposals',
          description: 'Get governance proposals on a Cosmos chain',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              status: {
                type: 'string',
                enum: ['deposit_period', 'voting_period', 'passed', 'rejected', 'failed'],
                description: 'Optional: Filter by proposal status',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain'],
          },
        },
        {
          name: 'get_cosmos_proposal',
          description: 'Get specific governance proposal details',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              proposalId: {
                type: 'number',
                description: 'Proposal ID',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'proposalId'],
          },
        },
        {
          name: 'get_cosmos_proposal_votes',
          description: 'Get all votes for a governance proposal',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              proposalId: {
                type: 'number',
                description: 'Proposal ID',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'proposalId'],
          },
        },
        {
          name: 'get_cosmos_latest_block',
          description: 'Get latest block information on a Cosmos chain',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain'],
          },
        },
        {
          name: 'get_cosmos_block',
          description: 'Get Cosmos block at specific height',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              height: {
                type: 'number',
                description: 'Block height',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'height'],
          },
        },
        {
          name: 'get_cosmos_params',
          description: 'Get chain parameters for a Cosmos module',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              module: {
                type: 'string',
                enum: ['staking', 'slashing', 'distribution', 'gov', 'mint'],
                description: 'Module to query parameters for',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain', 'module'],
          },
        },
      ];
    
      return tools;
    }

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