Skip to main content
Glama
lienhage

Blockchain MCP Server

by lienhage

keccak256

Compute the keccak256 hash of input data, a cryptographic function essential for Ethereum blockchain operations like address generation and smart contract interactions.

Instructions

calculate keccak256 hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesdata to hash

Implementation Reference

  • The async handler function for the 'keccak256' tool. It takes a 'data' input string, computes its Keccak-256 hash using ethers.keccak256(ethers.toUtf8Bytes(data)), and returns a text response with the hash.
    async ({ data }) => {
      const hash = ethers.keccak256(ethers.toUtf8Bytes(data));
      return {
        content: [{ type: "text", text: `keccak256 hash: ${hash}` }]
      };
    }
  • The schema definition for the 'keccak256' tool, including title, description, and Zod inputSchema requiring a 'data' string.
    {
      title: "keccak256",
      description: "calculate keccak256 hash",
      inputSchema: {
        data: z.string().describe("data to hash"),
      }
    },
  • The registration of the 'keccak256' tool via server.registerTool call within UtilsService.registerWithServer method.
    // tool to calculate keccak256 hash
    server.registerTool(
      "keccak256",
      {
        title: "keccak256",
        description: "calculate keccak256 hash",
        inputSchema: {
          data: z.string().describe("data to hash"),
        }
      },
      async ({ data }) => {
        const hash = ethers.keccak256(ethers.toUtf8Bytes(data));
        return {
          content: [{ type: "text", text: `keccak256 hash: ${hash}` }]
        };
      }
    );
Install Server

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