Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_cosmos_proposals

Retrieve governance proposals from Cosmos blockchains to track voting status, filter by proposal stage, and monitor network decisions.

Instructions

Get governance proposals on a Cosmos chain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockchainYesBlockchain name
statusNoOptional: Filter by proposal status
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • Input schema definition for the 'get_cosmos_proposals' tool, specifying parameters like blockchain, optional status filter, and network.
    {
      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'],
      },
    },
  • Handler logic for 'get_cosmos_proposals' tool within the handleCosmosTool switch statement. Extracts input arguments and delegates execution to CosmosService.getProposals, formats the response.
    case 'get_cosmos_proposals': {
      const blockchain = args?.blockchain as string;
      const status = args?.status as
        | 'deposit_period'
        | 'voting_period'
        | 'passed'
        | 'rejected'
        | 'failed'
        | undefined;
      const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet';
    
      const result = await cosmosService.getProposals(blockchain, status, network);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
        isError: !result.success,
      };
    }
  • Core implementation of proposal fetching in CosmosService. Constructs the REST API endpoint (/cosmos/gov/v1beta1/proposals) with optional status filter and performs HTTP GET request.
    async getProposals(
      blockchain: string,
      status?: 'deposit_period' | 'voting_period' | 'passed' | 'rejected' | 'failed',
      network: 'mainnet' | 'testnet' = 'mainnet'
    ): Promise<EndpointResponse> {
      try {
        const baseUrl = this.getRestUrl(blockchain, network);
        const statusFilter = status ? `?proposal_status=${status}` : '';
        const url = `${baseUrl}/cosmos/gov/v1beta1/proposals${statusFilter}`;
    
        return this.fetchRest(url);
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Failed to get Cosmos proposals',
        };
      }
    }
  • src/index.ts:123-124 (registration)
    Registration of cosmos tool handler in the main MCP CallToolRequestHandler. Includes handleCosmosTool in the execution chain for tool dispatch.
    (await handleSolanaTool(name, args, solanaService)) ||
    (await handleCosmosTool(name, args, cosmosService)) ||
  • src/index.ts:97-101 (registration)
    Tool schema registration: collects Tool objects from registerCosmosHandlers (which defines the schema for get_cosmos_proposals) into the main tools list provided to the MCP server.
      ...registerSolanaHandlers(server, solanaService),
      ...registerCosmosHandlers(server, cosmosService),
      ...registerSuiHandlers(server, suiService),
      ...registerDocsHandlers(server, docsManager),
    ];

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