Skip to main content
Glama

signMessage

Sign messages securely using Ethereum wallets on the MCP Ethers Wallet server. Process messages with optional network or custom RPC provider for enhanced blockchain interaction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesThe message to sign
providerNoOptional. Either a network name or custom RPC URL. Use getAllNetworks to see available networks and their details, or getNetwork to get info about a specific network. You can use any network name returned by these tools as a provider value.

Implementation Reference

  • The handler function for the signMessage tool. It retrieves the wallet using ethersService.getWallet(provider), checks if wallet exists, signs the message using wallet.signMessage(message), and returns a JSON object containing the message, signature, and signer address.
    async ({ message, provider }) => { try { // First check if a wallet exists const wallet = await ethersService.getWallet(provider); if (!wallet) { return { isError: true, content: [{ type: "text", text: "No wallet available to sign message. Please create or load a wallet first." }] }; } // Sign the message const signature = await wallet.signMessage(message); return { content: [{ type: "text", text: JSON.stringify({ message, signature, signer: wallet.address }, null, 2) }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error signing message: ${error instanceof Error ? error.message : String(error)}` }] }; } } );
  • Zod input schema for the signMessage tool: 'message' (required string), 'provider' (optional string describing network or RPC).
    { message: z.string().describe( "The message to sign" ), provider: z.string().optional().describe(PROVIDER_DESCRIPTION) },
  • Registers the 'signMessage' tool on the MCP server within the registerCoreTools function, specifying name, input schema, and handler.
    server.tool( "signMessage", { message: z.string().describe( "The message to sign" ), provider: z.string().optional().describe(PROVIDER_DESCRIPTION) }, async ({ message, provider }) => { try { // First check if a wallet exists const wallet = await ethersService.getWallet(provider); if (!wallet) { return { isError: true, content: [{ type: "text", text: "No wallet available to sign message. Please create or load a wallet first." }] }; } // Sign the message const signature = await wallet.signMessage(message); return { content: [{ type: "text", text: JSON.stringify({ message, signature, signer: wallet.address }, null, 2) }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error signing message: ${error instanceof Error ? error.message : String(error)}` }] }; } } );

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/crazyrabbitLTC/mcp-ethers-server'

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