Skip to main content
Glama
5ajaki

Veri5ight MCP Server

by 5ajaki

ethereum_getTokenDelegation

Retrieve delegation details for an ERC20 governance token by providing an Ethereum address and token contract. Part of Veri5ight MCP Server for Ethereum interactions.

Instructions

Get delegation info for an ERC20 governance token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesEthereum address or ENS name
tokenYesToken contract address or ENS name

Implementation Reference

  • The main handler function that implements the ethereum_getTokenDelegation tool. It queries the token contract for the delegate address and voting power using the provider.
      private async handleGetTokenDelegation(request: any) {
        try {
          const address = request.params.arguments?.address;
          const tokenAddress = request.params.arguments?.token;
    
          if (!address || !tokenAddress) {
            throw new Error("Address and token address are required");
          }
    
          // Create contract instance with both ERC20 and governance functions
          const tokenContract = new ethers.Contract(
            tokenAddress,
            [...ERC20_ABI, ...GOVERNANCE_ABI],
            this.provider
          );
    
          // Check if contract supports delegation
          try {
            const [delegate, votingPower, decimals, symbol] = await Promise.all([
              tokenContract.delegates(address),
              tokenContract.getVotes(address),
              tokenContract.decimals(),
              tokenContract.symbol(),
            ]);
    
            const formattedVotingPower = ethers.formatUnits(votingPower, decimals);
    
            return {
              content: [
                {
                  type: "text",
                  text: `Token Delegation Info for ${address}:
    • Delegated To: ${delegate === ethers.ZeroAddress ? "No delegation" : delegate}
    • Voting Power: ${formattedVotingPower} ${symbol}`,
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Token at ${tokenAddress} does not support delegation.`,
                },
              ],
            };
          }
        } catch (error: unknown) {
          console.error("Error getting token delegation:", error);
          const errorMessage =
            error instanceof Error ? error.message : "Unknown error occurred";
          return {
            content: [
              {
                type: "text",
                text: `Error getting token delegation: ${errorMessage}`,
              },
            ],
          };
        }
  • The input schema definition for the ethereum_getTokenDelegation tool, specifying required address and token parameters.
    {
      name: "ethereum_getTokenDelegation",
      description: "Get delegation info for an ERC20 governance token",
      inputSchema: {
        type: "object",
        properties: {
          address: {
            type: "string",
            description: "Ethereum address or ENS name",
          },
          token: {
            type: "string",
            description: "Token contract address or ENS name",
          },
        },
        required: ["address", "token"],
      },
    },
  • src/index.ts:156-157 (registration)
    The switch case registration that routes calls to the ethereum_getTokenDelegation handler function.
    case "ethereum_getTokenDelegation":
      return await this.handleGetTokenDelegation(request);
  • Governance ABI fragment used by the handler to query delegation and votes.
    const GOVERNANCE_ABI = [
      "function delegates(address) view returns (address)",
      "function getVotes(address) view returns (uint256)",
    ];
  • ERC20 ABI fragment used in the handler for token metadata like decimals and symbol.
    const ERC20_ABI = [
      "function name() view returns (string)",
      "function symbol() view returns (string)",
      "function decimals() view returns (uint8)",
      "function totalSupply() view returns (uint256)",
      "function balanceOf(address) view returns (uint256)",
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe any behavioral traits such as whether it's read-only, requires authentication, has rate limits, or what format the delegation info returns. This leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the tool's purpose without any unnecessary words. It's front-loaded with the core functionality, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't address what 'delegation info' entails, how it's structured, or any behavioral aspects like error handling. For a tool with two parameters and no structured output information, more context is needed to fully understand its operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters ('address' and 'token'). The description doesn't add any additional semantic meaning beyond what the schema provides, such as explaining the relationship between the parameters or providing usage examples. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('delegation info for an ERC20 governance token'), making it immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'ethereum_getTokenBalance' or 'ethereum_getContractInfo', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, context for usage, or comparisons to sibling tools, leaving the agent to infer usage scenarios based solely on the tool name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/5ajaki/veri5ight'

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