delegate
Stake tokens with a chosen validator on MantraChain by specifying the amount, network, and validator address. Use the MCP server to manage blockchain assets efficiently.
Instructions
Delegate/Stake tokens to a validator
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount of tokens to delegate | |
| denom | No | Optional denomination of the tokens, default is network's default denom | |
| memo | No | Optional memo for the transaction | |
| networkName | Yes | Name 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 | |
| operatorAddress | Yes | Address of the validator to delegate to |
Implementation Reference
- src/tools/staking.ts:21-35 (handler)Handler function that implements the logic for the 'delegate' tool by initializing the MantraClient and calling stakeTokens to delegate tokens to a validator.async ({ operatorAddress, amount, denom, networkName, memo }) => { await mantraClient.initialize(networkName); // Delegate the tokens const result = await mantraClient.stakeTokens({ operatorAddress, amount, denom, memo }); return { content: [{type: "text", text: JSON.stringify(result)}], }; }
- src/tools/staking.ts:12-20 (schema)Input schema definition for the 'delegate' tool using Zod validation.{ operatorAddress: z.string().describe("Address of the validator to delegate to"), amount: z.string().describe("Amount of tokens to delegate"), denom: z.string().optional().describe("Optional denomination of the tokens, default is network's default denom"), 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") },
- src/tools/staking.ts:9-36 (registration)Registration of the 'delegate' tool on the MCP server using server.tool, including description, schema, and handler function.server.tool( "delegate", "Delegate/Stake tokens to a validator", { operatorAddress: z.string().describe("Address of the validator to delegate to"), amount: z.string().describe("Amount of tokens to delegate"), denom: z.string().optional().describe("Optional denomination of the tokens, default is network's default denom"), 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, amount, denom, networkName, memo }) => { await mantraClient.initialize(networkName); // Delegate the tokens const result = await mantraClient.stakeTokens({ operatorAddress, amount, denom, memo }); return { content: [{type: "text", text: JSON.stringify(result)}], }; } );
- src/tools/index.ts:21-21 (registration)High-level registration call to registerStakingTools which defines and registers the 'delegate' tool among others.registerStakingTools(server, mantraClient);