get_cosmos_proposals
Retrieve governance proposals for Cosmos blockchains, allowing users to filter by status and network to monitor and analyze chain governance activities.
Instructions
Get governance proposals on a Cosmos chain
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name | |
| status | No | Optional: Filter by proposal status | |
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- src/handlers/cosmos-handlers.ts:554-576 (handler)MCP tool handler that extracts arguments (blockchain, status, network) and calls CosmosService.getProposals to fetch and return governance proposals.
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, }; } - src/handlers/cosmos-handlers.ts:232-255 (registration)Tool registration definition including name, description, and input schema for get_cosmos_proposals.
{ 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'], }, }, - Input schema defining parameters for the get_cosmos_proposals tool.
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'], }, - Core helper method in CosmosService that constructs the REST API URL for governance proposals and fetches the data.
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', }; } }