Skip to main content
Glama
RockYuan

MCP Smart Contract Analyst

by RockYuan

analyze-verified-contract

Analyze verified smart contracts on Monad testnet to assess functionality and security by providing a contract address.

Instructions

Analyze a verified contract from an address on the Monad testnet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesMonad testnet address to analyze verified contract for

Implementation Reference

  • The main handler function for the 'analyze-verified-contract' tool. It fetches verified source code from an API endpoint using the provided address, concatenates multiple source files if present, and returns a formatted text response for analysis, handling errors appropriately.
      async ({ address }) => {
        try {
          const apiUrl = process.env.API_URL
          const apiKey = process.env.API_KEY;
    
          if (!apiUrl) {
            throw new Error("API_URL not set.");
          }
    
          if (!apiKey) {
            throw new Error("API_KEY not set.");
          }
    
          const url = `${apiUrl}${address}`;
    
          const response = await fetch(url, {
            method: 'GET',
            headers: {
              "accept": "application/json",
              "x-api-key": apiKey
            }
          });
    
          if (!response.ok) {
            throw new Error(`API request failed with status ${response.status}`);
          }
    
          const data = await response.json();
    
          if (data.code !== 0) {
            throw new Error(`API request failed with error: ${data.message}`);
          }
    
          const sourceCodeList = data.result.sourceCode;
    
          if (sourceCodeList && sourceCodeList.length > 0) {
            const allSourceCode = sourceCodeList
              .map((item: { content: string }) => item.content)
              .join('\n\n');
    
            return {
              content: [
                {
                  type: "text",
                  text: `Analyze the source code of smart contract, including its core functionalities, main logic flow, and security aspects:\n\`\`\`\n${allSourceCode}\n\`\`\``,
                },
              ],
            };
          } else {
            throw new Error(`Failed to retrieve source code`);
          }
        } catch (error) {
          console.error("Error getting contract sourceCode:", error);
          return {
            content: [
              {
                type: "text",
                text: `Failed to retrieve contract sourceCode for address: ${address}. Error: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Input schema defined using Zod, requiring a 'address' string parameter describing the Monad testnet contract address.
    {
      address: z.string().describe("Monad testnet address to analyze verified contract for"),
    },
  • src/index.ts:31-32 (registration)
    Registration of the 'analyze-verified-contract' tool using server.tool(), including name, description, schema, and handler.
    server.tool(
      "analyze-verified-contract",
  • src/index.ts:28-28 (registration)
    Declaration of server capabilities, listing 'analyze-verified-contract' as a supported tool.
    capabilities: ["analyze-verified-contract", "analyze-unverified-contract"]
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 action ('analyze') but doesn't explain what analysis entails (e.g., returns contract code, metadata, or insights), potential errors (e.g., invalid addresses), or side effects. 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 that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to parse 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 explain what the analysis returns (e.g., contract details, vulnerabilities) or handle complexities like error cases, which are crucial for a tool interacting with blockchain data. This falls short of providing enough context for effective use.

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 schema description coverage is 100%, with the single parameter 'address' fully documented in the schema. The description adds no additional meaning beyond what the schema provides (e.g., format constraints or examples), so it meets the baseline of 3 where the schema does the heavy lifting.

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 action ('analyze') and resource ('verified contract from an address on the Monad testnet'), making the purpose understandable. However, it doesn't explicitly differentiate from its sibling tool 'analyze-unverified-contract' beyond the 'verified' qualifier, which is implied but not contrasted directly.

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, such as its sibling 'analyze-unverified-contract'. It lacks context about prerequisites (e.g., what constitutes a 'verified' contract) or exclusions, leaving usage decisions ambiguous.

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

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/RockYuan/mcp-contract-analyst'

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