search_cosmos_transactions
Search and filter Cosmos blockchain transactions using event-based criteria to locate specific on-chain activities across mainnet and testnet networks.
Instructions
Search Cosmos transactions by events
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name | |
| events | Yes | Event filters (e.g., ["message.sender=cosmos1...", "transfer.amount=1000uosmo"]) | |
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- src/handlers/cosmos-handlers.ts:536-552 (handler)MCP tool handler for 'search_cosmos_transactions'. Extracts parameters from args and delegates to CosmosService.searchTransactions, then formats the response.case 'search_cosmos_transactions': { const blockchain = args?.blockchain as string; const events = args?.events as string[]; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await cosmosService.searchTransactions(blockchain, events, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- Core implementation of transaction search. Constructs REST API query URL using event filters and fetches from Cosmos RPC endpoint via fetchRest.async searchTransactions( blockchain: string, events: string[], network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { try { const baseUrl = this.getRestUrl(blockchain, network); const eventsQuery = events.map(e => `events=${encodeURIComponent(e)}`).join('&'); const url = `${baseUrl}/cosmos/tx/v1beta1/txs?${eventsQuery}`; return this.fetchRest(url); } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to search Cosmos transactions', }; } }
- Input schema and tool definition for 'search_cosmos_transactions' used in tool registration.{ name: 'search_cosmos_transactions', description: 'Search Cosmos transactions by events', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, events: { type: 'array', items: { type: 'string' }, description: 'Event filters (e.g., ["message.sender=cosmos1...", "transfer.amount=1000uosmo"])', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'events'], }, },
- src/handlers/cosmos-handlers.ts:10-371 (registration)Function that registers all Cosmos tools including 'search_cosmos_transactions' by returning Tool[] array to the MCP server.export function registerCosmosHandlers( server: Server, cosmosService: CosmosService ): Tool[] { const tools: Tool[] = [ { name: 'get_cosmos_balance', description: 'Get balance for a Cosmos SDK address on any Cosmos chain', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name (e.g., "osmosis", "juno", "kava", "akash")', }, address: { type: 'string', description: 'Cosmos address', }, denom: { type: 'string', description: 'Optional: Specific denomination to query (e.g., "uosmo", "ujuno")', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'address'], }, }, { name: 'get_cosmos_all_balances', description: 'Get all token balances for a Cosmos SDK address', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name (e.g., "osmosis", "juno", "kava")', }, address: { type: 'string', description: 'Cosmos address', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'address'], }, }, { name: 'get_cosmos_account', description: 'Get Cosmos account information (sequence, account number)', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, address: { type: 'string', description: 'Cosmos address', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'address'], }, }, { 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'], }, }, { name: 'get_cosmos_validators', description: 'Get list of validators on a Cosmos chain', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, status: { type: 'string', enum: ['bonded', 'unbonded', 'unbonding', 'all'], description: 'Validator status filter (defaults to bonded)', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain'], }, }, { name: 'get_cosmos_validator', description: 'Get specific validator details', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, validatorAddress: { type: 'string', description: 'Validator address', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'validatorAddress'], }, }, { name: 'get_cosmos_rewards', description: 'Get staking rewards for a delegator', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, delegatorAddress: { type: 'string', description: 'Delegator address', }, validatorAddress: { type: 'string', description: 'Optional: Specific validator address', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'delegatorAddress'], }, }, { 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'], }, }, { name: 'search_cosmos_transactions', description: 'Search Cosmos transactions by events', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, events: { type: 'array', items: { type: 'string' }, description: 'Event filters (e.g., ["message.sender=cosmos1...", "transfer.amount=1000uosmo"])', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'events'], }, }, { 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'], }, }, { name: 'get_cosmos_proposal', description: 'Get specific governance proposal details', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, proposalId: { type: 'number', description: 'Proposal ID', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'proposalId'], }, }, { name: 'get_cosmos_proposal_votes', description: 'Get all votes for a governance proposal', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, proposalId: { type: 'number', description: 'Proposal ID', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'proposalId'], }, }, { 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'], }, }, { name: 'get_cosmos_block', description: 'Get Cosmos block at specific height', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, height: { type: 'number', description: 'Block height', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'height'], }, }, { name: 'get_cosmos_params', description: 'Get chain parameters for a Cosmos module', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, module: { type: 'string', enum: ['staking', 'slashing', 'distribution', 'gov', 'mint'], description: 'Module to query parameters for', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'module'], }, }, ]; return tools; }