Skip to main content
Glama
5ajaki

Veri5ight MCP Server

by 5ajaki

ethereum_getContractInfo

Retrieve detailed information about Ethereum smart contracts, including code and metadata, by specifying the contract address or ENS name using the Veri5ight MCP Server.

Instructions

Get information about any contract

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesContract address or ENS name

Implementation Reference

  • Main handler function for ethereum_getContractInfo tool. Retrieves contract bytecode size and attempts to fetch ERC20 token metadata (name, symbol, decimals, total supply).
      private async handleGetContractInfo(request: any) {
        try {
          const address = request.params.arguments?.address;
          if (!address) {
            throw new Error("Address is required");
          }
    
          // Get basic contract info
          const code = await this.provider.getCode(address);
          if (code === "0x") {
            throw new Error("No contract found at this address");
          }
    
          // Try to get ERC20 info if available
          let tokenInfo = "";
          try {
            const contract = new ethers.Contract(address, ERC20_ABI, this.provider);
            const [name, symbol, decimals, totalSupply] = await Promise.all([
              contract.name().catch(() => null),
              contract.symbol().catch(() => null),
              contract.decimals().catch(() => null),
              contract.totalSupply().catch(() => null),
            ]);
    
            if (name || symbol || decimals || totalSupply) {
              tokenInfo = `\n\nERC20 Token Information:
    • Name: ${name || "N/A"}
    • Symbol: ${symbol || "N/A"}
    • Decimals: ${decimals || "N/A"}
    • Total Supply: ${
                totalSupply
                  ? ethers.formatUnits(totalSupply, decimals || 18)
                  : "N/A"
              } ${symbol || ""}`;
            }
          } catch (error) {
            console.error("Not an ERC20 token or error getting token info:", error);
          }
    
          return {
            content: [
              {
                type: "text",
                text: `Contract Information for ${address}:
    • Bytecode Size: ${(code.length - 2) / 2} bytes
    • Contract Address: ${address}${tokenInfo}`,
              },
            ],
          };
        } catch (error: unknown) {
          console.error("Error getting contract info:", error);
          const errorMessage =
            error instanceof Error ? error.message : "Unknown error occurred";
          return {
            content: [
              {
                type: "text",
                text: `Error getting contract info: ${errorMessage}`,
              },
            ],
          };
        }
      }
  • Tool schema definition including name, description, and input schema requiring 'address' parameter.
    {
      name: "ethereum_getContractInfo",
      description: "Get information about any contract",
      inputSchema: {
        type: "object",
        properties: {
          address: {
            type: "string",
            description: "Contract address or ENS name",
          },
        },
        required: ["address"],
      },
  • src/index.ts:151-165 (registration)
    Switch statement in CallToolRequestSchema handler that registers and dispatches to the ethereum_getContractInfo handler.
      switch (request.params.name) {
        case "ethereum_getRecentTransactions":
          return await this.handleGetRecentTransactions(request);
        case "ethereum_getTokenBalance":
          return await this.handleGetTokenBalance(request);
        case "ethereum_getTokenDelegation":
          return await this.handleGetTokenDelegation(request);
        case "ethereum_getContractInfo":
          return await this.handleGetContractInfo(request);
        case "ethereum_getTransactionInfo":
          return await this.handleGetTransactionInfo(request);
        default:
          throw new Error(`Unknown tool: ${request.params.name}`);
      }
    });
  • src/index.ts:57-145 (registration)
    Registration of tool list including ethereum_getContractInfo schema in ListToolsRequestSchema handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.error("tools/list called");
      return {
        tools: [
          {
            name: "ethereum_getRecentTransactions",
            description: "Get recent transactions for an Ethereum address",
            inputSchema: {
              type: "object",
              properties: {
                address: {
                  type: "string",
                  description: "Ethereum address or ENS name",
                },
                limit: {
                  type: "number",
                  description: "Number of transactions to return (default: 3)",
                },
              },
              required: ["address"],
            },
          },
          {
            name: "ethereum_getTokenBalance",
            description: "Get ERC20 token balance for an address",
            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"],
            },
          },
          {
            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"],
            },
          },
          {
            name: "ethereum_getContractInfo",
            description: "Get information about any contract",
            inputSchema: {
              type: "object",
              properties: {
                address: {
                  type: "string",
                  description: "Contract address or ENS name",
                },
              },
              required: ["address"],
            },
          },
          {
            name: "ethereum_getTransactionInfo",
            description:
              "Get detailed information about an Ethereum transaction",
            inputSchema: {
              type: "object",
              properties: {
                hash: {
                  type: "string",
                  description: "Transaction hash",
                },
              },
              required: ["hash"],
            },
          },
        ],
      };
  • ERC20 ABI constants used by the handler to query token metadata.
    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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get information' but doesn't clarify what type of information (e.g., ABI, bytecode, metadata), whether it's read-only or has side effects, or any constraints like rate limits or authentication needs. This leaves significant gaps in understanding the tool's behavior.

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, efficient sentence with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence contributes directly to stating the tool's purpose.

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 explain what information is returned (e.g., contract details, metadata), how errors are handled, or any behavioral traits. For a tool with no structured behavioral data, the description should provide more context to compensate, but it falls short.

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, with the 'address' parameter documented as 'Contract address or ENS name'. The description adds no additional meaning beyond this, such as format examples or validation rules. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles the parameter documentation adequately.

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

Purpose3/5

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

The description 'Get information about any contract' states a clear verb ('Get') and resource ('contract'), but it's vague about what specific information is retrieved. It doesn't differentiate from sibling tools like ethereum_getTransactionInfo or ethereum_getTokenBalance, which also retrieve contract-related information. The purpose is understandable but lacks specificity.

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 what makes it distinct from sibling tools such as ethereum_getTransactionInfo or ethereum_getTokenDelegation, nor does it specify prerequisites or exclusions. Without this context, the agent must infer usage from the tool name alone.

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