Skip to main content
Glama

claim-rewards

Claim validator rewards on MantraChain using the MCP Server. Enter the validator's operator address and network name, with an optional memo, to process the transaction.

Instructions

Claim rewards for a specific validator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memoNoOptional memo for the transaction
networkNameYesName of the network to use - must first check what networks are available through the mantrachain-mcp server by accessing the networks resource `networks://all` before you pass this arguments
operatorAddressYesAddress of the validator to claim rewards from

Implementation Reference

  • MCP tool execution handler for 'claim-rewards'. Initializes the MantraClient for the specified network and calls the client's claimRewards method, returning the transaction result as JSON.
    async ({ operatorAddress, networkName, memo }) => { await mantraClient.initialize(networkName); const result = await mantraClient.claimRewards({ operatorAddress, memo }); return { content: [{type: "text", text: JSON.stringify(result)}], }; }
  • Zod schema defining input parameters for the 'claim-rewards' tool: operatorAddress (required), networkName (required, validated against available networks), memo (optional).
    operatorAddress: z.string().describe("Address of the validator to claim rewards from"), networkName: z.string().refine(val => Object.keys(networks).includes(val), { message: "Must be a valid network name" }).describe("Name of the network to use - must first check what networks are available by accessing the networks resource `networks://all` before you pass this arguments. Defaults to `mantra-dukong-1` testnet."), memo: z.string().optional().describe("Optional memo for the transaction") },
  • Registration of the 'claim-rewards' tool on the MCP server within the registerStakingTools function, specifying name, description, input schema, and handler.
    server.tool( "claim-rewards", "Claim rewards for a specific validator", { operatorAddress: z.string().describe("Address of the validator to claim rewards from"), networkName: z.string().refine(val => Object.keys(networks).includes(val), { message: "Must be a valid network name" }).describe("Name of the network to use - must first check what networks are available by accessing the networks resource `networks://all` before you pass this arguments. Defaults to `mantra-dukong-1` testnet."), memo: z.string().optional().describe("Optional memo for the transaction") }, async ({ operatorAddress, networkName, memo }) => { await mantraClient.initialize(networkName); const result = await mantraClient.claimRewards({ operatorAddress, memo }); return { content: [{type: "text", text: JSON.stringify(result)}], }; } );
  • Supporting utility in StakingService: the claimRewards method that performs the actual blockchain interaction by calling withdrawRewards on the wasmClient to claim staking rewards.
    async claimRewards({ operatorAddress, memo = '' }: ClaimRewardsParams): Promise<TransactionResponse> { try { const result = await this.wasmClient.withdrawRewards( this.address, operatorAddress, 'auto', memo ); return { transactionHash: result.transactionHash, explorerUrl: `${this.network.explorerUrl}/tx/${result.transactionHash}`, success: result.code === 0, gasUsed: result.gasUsed.toString(), gasWanted: result.gasWanted.toString(), }; } catch (error) { throw new Error(`Failed to claim rewards: ${error instanceof Error ? error.message : String(error)}`); } }
  • Wrapper method in MantraClient that delegates claimRewards to the underlying StakingService instance.
    async claimRewards(params: ClaimRewardsParams): Promise<TransactionResponse> { if (!this.stakingService) { throw new Error('Client not initialized. Call initialize() first.'); } return this.stakingService.claimRewards(params); }

Other Tools

Related Tools

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/allthatjazzleo/mantrachain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server