Skip to main content
Glama
lienhage
by lienhage

event-sig

Extract event selectors for Ethereum smart contracts by inputting event names. Use this tool to simplify interactions with blockchain events and enhance contract analysis.

Instructions

get event selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventNameYesevent name, e.g. 'Transfer(address indexed from, address indexed to, uint256 amount)'

Implementation Reference

  • The handler function for the "event-sig" tool. It computes the event selector by hashing the event name with keccak256 and taking the first 10 characters (4 bytes).
    async ({ eventName }) => { const eventSignature = ethers.keccak256(ethers.toUtf8Bytes(eventName)).slice(0, 10); return { content: [{ type: "text", text: `event signature: ${eventSignature}` }] }; }
  • Schema definition including title, description, and input schema using Zod for the eventName parameter.
    { title: "event-sig", description: "get event selector", inputSchema: { eventName: z.string().describe("event name, e.g. 'Transfer(address indexed from, address indexed to, uint256 amount)'"), } },
  • Registration of the "event-sig" tool within the UtilsService.registerWithServer method using server.registerTool.
    // register tools to get event signature server.registerTool( "event-sig", { title: "event-sig", description: "get event selector", inputSchema: { eventName: z.string().describe("event name, e.g. 'Transfer(address indexed from, address indexed to, uint256 amount)'"), } }, async ({ eventName }) => { const eventSignature = ethers.keccak256(ethers.toUtf8Bytes(eventName)).slice(0, 10); return { content: [{ type: "text", text: `event signature: ${eventSignature}` }] }; } );

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/lienhage/blockchain-mcp'

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