Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_cosmos_latest_block

Retrieve current block data from Cosmos-based blockchains to monitor network activity and verify transactions.

Instructions

Get latest block information on a Cosmos chain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockchainYesBlockchain name
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • MCP tool handler case: extracts blockchain and network parameters from args, calls cosmosService.getLatestBlock, and returns formatted MCP response content or error.
    case 'get_cosmos_latest_block': { const blockchain = args?.blockchain as string; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await cosmosService.getLatestBlock(blockchain, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
  • Tool registration: defines the tool name, description, and input schema for validation in the registerCosmosHandlers function.
    { 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'], }, },
  • Core implementation: constructs the Cosmos REST API URL for the latest block and performs the HTTP GET request using fetchRest.
    async getLatestBlock( blockchain: string, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { try { const baseUrl = this.getRestUrl(blockchain, network); const url = `${baseUrl}/cosmos/base/tendermint/v1beta1/blocks/latest`; return this.fetchRest(url); } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get Cosmos latest block', }; } }

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