get_cosmos_transaction
Retrieve Cosmos blockchain transaction details using transaction hash to inspect transaction data, verify transfers, and analyze on-chain activity across mainnet and testnet networks.
Instructions
Get Cosmos transaction by hash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name | |
| network | No | Network type (defaults to mainnet) | |
| txHash | Yes | Transaction hash |
Implementation Reference
- src/handlers/cosmos-handlers.ts:518-534 (handler)Handler case in handleCosmosTool that extracts input parameters, calls CosmosService.getTransaction, and formats the response for the MCP tool execution.case 'get_cosmos_transaction': { const blockchain = args?.blockchain as string; const txHash = args?.txHash as string; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await cosmosService.getTransaction(blockchain, txHash, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- Tool definition including name, description, and input schema for validating parameters in the MCP tool registry.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'], }, },
- src/index.ts:88-101 (registration)Registers all tools with the MCP server by collecting Tool objects from various handler modules, including Cosmos tools containing get_cosmos_transaction.const tools: Tool[] = [ ...registerBlockchainHandlers(server, blockchainService), ...registerDomainHandlers(server, domainResolver), ...registerTransactionHandlers(server, advancedBlockchain), ...registerTokenHandlers(server, advancedBlockchain), ...registerMultichainHandlers(server, advancedBlockchain), ...registerContractHandlers(server, advancedBlockchain), ...registerUtilityHandlers(server, advancedBlockchain), ...registerEndpointHandlers(server, endpointManager), ...registerSolanaHandlers(server, solanaService), ...registerCosmosHandlers(server, cosmosService), ...registerSuiHandlers(server, suiService), ...registerDocsHandlers(server, docsManager), ];
- Core service method that constructs the Cosmos REST API URL for transaction lookup and fetches the data using the internal fetchRest helper.async getTransaction( blockchain: string, txHash: string, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { try { const baseUrl = this.getRestUrl(blockchain, network); const url = `${baseUrl}/cosmos/tx/v1beta1/txs/${txHash}`; return this.fetchRest(url); } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get Cosmos transaction', }; } }