Skip to main content
Glama
dewanshparashar

Arbitrum MCP Server

is_contract

Determine if an Arbitrum address represents a smart contract by checking its code storage. This tool helps verify contract existence for interactions and security assessments on Arbitrum networks.

Instructions

Check if an address is a contract

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rpcUrlNoThe RPC URL of the chain (optional if default is set)
addressYesAddress to check

Implementation Reference

  • Handler for the 'is_contract' MCP tool. Resolves RPC URL, creates EthereumAccountClient instance, calls isContract(address), and returns whether the address is a contract.
    case "is_contract": {
      const rpcUrl = await this.resolveRpcUrl(
        (args.rpcUrl as string) || (args.chainName as string)
      );
      const ethereumAccountClient = new EthereumAccountClient(rpcUrl);
      const isContract = await ethereumAccountClient.isContract(
        args.address as string
      );
      return {
        content: [
          {
            type: "text",
            text: `Is contract: ${isContract}`,
          },
        ],
      };
    }
  • Input schema definition for the 'is_contract' tool, specifying parameters rpcUrl (optional) and address (required). Part of the tools list returned by list tools request.
      name: "is_contract",
      description: "Check if an address is a contract",
      inputSchema: {
        type: "object" as const,
        properties: {
          rpcUrl: {
            type: "string",
            description:
              "The RPC URL of the chain (optional if default is set)",
          },
          address: {
            type: "string",
            description: "Address to check",
          },
        },
        required: ["address"],
      },
    },
  • src/index.ts:1020-1037 (registration)
    Tool registration in the getAvailableTools() method, which defines the 'is_contract' tool name, description, and schema for the MCP list tools endpoint.
      name: "is_contract",
      description: "Check if an address is a contract",
      inputSchema: {
        type: "object" as const,
        properties: {
          rpcUrl: {
            type: "string",
            description:
              "The RPC URL of the chain (optional if default is set)",
          },
          address: {
            type: "string",
            description: "Address to check",
          },
        },
        required: ["address"],
      },
    },
  • Core helper function in EthereumAccountClient that implements the contract check logic by fetching bytecode via getCode and checking if it's non-empty ('0x'). Called by the tool handler.
    async isContract(address: string): Promise<boolean> {
      const code = await this.getCode(address);
      return code !== '0x';
    }

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/dewanshparashar/arbitrum-mcp'

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