Skip to main content
Glama
lienhage
by lienhage

sig

Generate function selectors from Ethereum smart contract function signatures. Input a function signature to derive the corresponding selector for blockchain interactions.

Instructions

get function selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
functionNameYesfunction signature, e.g. 'transfer(address,uint256)'

Implementation Reference

  • The handler function that computes the Ethereum function selector (first 4 bytes of keccak256 hash of the function signature).
    async ({ functionName }) => { const functionSelector = ethers.keccak256(ethers.toUtf8Bytes(functionName)).slice(0, 10); return { content: [{ type: "text", text: `function selector: ${functionSelector}` }] }; }
  • The tool metadata including title, description, and input schema using Zod for validation.
    title: "sig", description: "get function selector", inputSchema: { functionName: z.string().describe("function signature, e.g. 'transfer(address,uint256)'"), } },
  • Registers the 'sig' tool on the MCP server using server.registerTool.
    "sig", { title: "sig", description: "get function selector", inputSchema: { functionName: z.string().describe("function signature, e.g. 'transfer(address,uint256)'"), } }, async ({ functionName }) => { const functionSelector = ethers.keccak256(ethers.toUtf8Bytes(functionName)).slice(0, 10); return { content: [{ type: "text", text: `function selector: ${functionSelector}` }] }; } );

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