Skip to main content
Glama

contract_summary

Retrieve essential summary information for Ethereum smart contracts without executing functions. Input the contract address to get an overview of its structure and details.

Instructions

获取合约基本摘要信息,不调用合约函数,快速获取合约概况 Args: contract_address: EVM 合约地址 (0x开头的42位十六进制字符串) Returns: 合约的基本摘要信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_addressYes

Implementation Reference

  • The primary handler for the 'contract_summary' MCP tool. Decorated with @mcp.tool() for registration, validates the contract address input, delegates to analyzer.get_contract_summary(), formats the result as JSON, and handles errors.
    @mcp.tool() async def contract_summary(contract_address: str): """ 获取合约基本摘要信息,不调用合约函数,快速获取合约概况 Args: contract_address: EVM 合约地址 (0x开头的42位十六进制字符串) Returns: 合约的基本摘要信息 """ # 验证合约地址格式 if not contract_address or not isinstance(contract_address, str): raise ValueError("合约地址不能为空且必须是字符串") if not contract_address.startswith("0x") or len(contract_address) != 42: raise ValueError("合约地址格式无效,必须是0x开头的42位十六进制字符串") try: print(f"📋 获取合约摘要: {contract_address}") # 获取合约摘要 result = await analyzer.get_contract_summary(contract_address) # 格式化输出 formatted_result = json.dumps(result, ensure_ascii=False, indent=2) print(f"✅ 合约摘要获取完成: {contract_address}") return formatted_result except Exception as e: error_msg = f"获取合约摘要失败: {str(e)}" print(f"❌ {error_msg}") error_response = { "status": "error", "error": error_msg, "contract_address": contract_address, "tool": "contract_summary" } return json.dumps(error_response, ensure_ascii=False, indent=2)
  • Core helper function that implements the contract summary logic: validates address, checks if it's a contract via Web3, verification status and name via Etherscan.
    async def get_contract_summary(self, contract_address: str) -> Dict[str, Any]: """ 获取合约基本信息摘要 Args: contract_address: 合约地址 Returns: Dict: 合约摘要信息 """ if not is_valid_ethereum_address(contract_address): return {"error": "无效的地址格式"} checksum_address = to_checksum_address(contract_address) # 基本信息 summary = { "address": checksum_address, "is_contract": await self.web3_client.is_contract_address(checksum_address), "is_verified": await self.etherscan_client.is_contract_verified(checksum_address), "contract_name": await self.etherscan_client.get_contract_name(checksum_address) } return summary

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/ACaiSec/ContractInfoMCP'

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