Skip to main content
Glama

get-delegations

Retrieve current staking details for a specific address on the MantraChain network using the Model Context Protocol (MCP) server. Query delegations by specifying the address and network name.

Instructions

Get current staking information for an address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressNoAddress to query for delegations
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

Implementation Reference

  • MCP tool handler for 'get-delegations': initializes the MantraClient for the specified network and fetches delegations for the given address (or default), converts BigInts to strings, and returns as JSON text content.
    async ({ address, networkName }) => { await mantraClient.initialize(networkName); const delegations = await mantraClient.getDelegations(address); return { content: [{type: "text", text: JSON.stringify(convertBigIntToString(delegations))}], }; }
  • Input schema validation using Zod for the get-delegations tool parameters: optional address and networkName with validation.
    { address: z.string().optional().describe("Address to query for delegations"), 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."), },
  • Registration of the 'get-delegations' tool on the MCP server within the registerStakingTools function.
    server.tool( "get-delegations", "Get current staking information for an address", { address: z.string().optional().describe("Address to query for delegations"), 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."), }, async ({ address, networkName }) => { await mantraClient.initialize(networkName); const delegations = await mantraClient.getDelegations(address); return { content: [{type: "text", text: JSON.stringify(convertBigIntToString(delegations))}], }; } );
  • Core implementation helper: StakingService.getDelegations method that queries the blockchain for a delegator's delegations using the Stargate query client.
    async getDelegations(address?: string) { try { const delegatorAddress = address || this.address; const response = await this.queryClient.staking.delegatorDelegations(delegatorAddress); return response.delegationResponses; } catch (error) { throw new Error(`Failed to fetch delegations: ${error instanceof Error ? error.message : String(error)}`); } }
  • High-level registration call for all staking tools (including get-delegations) in the main tools index.
    registerStakingTools(server, mantraClient);

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