Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

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
NameRequiredDescriptionDefault
blockchainYesBlockchain name
delegatorAddressYesDelegator address
networkNoNetwork 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'],
      },
    },
  • Execution handler in handleCosmosTool that parses input arguments, calls the service method, and formats the response
    case '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 delegations
    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',
        };
      }
    }

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