wallet_sign_message
Sign messages securely using the MCP Crypto Wallet EVM server. Enable Ethereum and EVM-compatible blockchain operations by providing a wallet (private key, mnemonic, or JSON) and the message to sign.
Instructions
Sign a message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | The message to sign | |
| wallet | No | The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set. |
Implementation Reference
- src/handlers/wallet.ts:395-411 (handler)The core handler function that performs the message signing using the ethers Wallet instance's signMessage method. It retrieves the wallet using getWallet helper, signs the message, and returns the signature.export const signMessageHandler = async (input: any): Promise<ToolResultSchema> => { try { if (!input.message) { return createErrorResponse("Message is required"); } const wallet = await getWallet(input.wallet, input.password); const signature = await wallet.signMessage(input.message); return createSuccessResponse(`Message signed successfully Signature: ${signature} Message: "${input.message}" `); } catch (error) { return createErrorResponse(`Failed to sign message: ${(error as Error).message}`); } };
- src/tools.ts:335-346 (schema)Defines the tool metadata including name, description, and input schema (wallet optional, message required) for validation in the MCP tool system.{ name: "wallet_sign_message", description: "Sign a message", inputSchema: { type: "object", properties: { wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." }, message: { type: "string", description: "The message to sign" } }, required: ["message"] } },
- src/tools.ts:583-584 (registration)Registers the signMessageHandler function to the 'wallet_sign_message' tool name in the handlers dictionary, mapping tool calls to the implementation.// Signing Methods "wallet_sign_message": signMessageHandler,