Skip to main content
Glama

sign-message

Sign messages securely using your MetaMask wallet. This tool ensures private keys remain protected while enabling blockchain transactions and operations.

Instructions

Sign a message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesMessage to sign.

Implementation Reference

  • The execute handler function that implements the core logic of signing a message using wagmi's signMessage function and returning the resulting hash.
    execute: async (args, { log }) => { try { const message = args.message; const result = await signMessage(wagmiConfig, { message, }); return { content: [ { type: "text", text: JSONStringify({ hash: result, }), }, ], }; } catch (error) { log.debug((error as Error).message); throw error; } },
  • Zod schema defining the input parameters for the sign-message tool.
    parameters: z.object({ message: z.string().describe("Message to sign."), }),
  • The registration function that adds the sign-message tool to the FastMCP server, defining name, description, schema, and handler.
    export function registerSignMessageTools(server: FastMCP, wagmiConfig: Config): void { server.addTool({ name: "sign-message", description: "Sign a message.", parameters: z.object({ message: z.string().describe("Message to sign."), }), execute: async (args, { log }) => { try { const message = args.message; const result = await signMessage(wagmiConfig, { message, }); return { content: [ { type: "text", text: JSONStringify({ hash: result, }), }, ], }; } catch (error) { log.debug((error as Error).message); throw error; } }, }); };
  • Call to register the sign-message tool as part of the overall tools registration.
    registerSignMessageTools(server, wagmiConfig);
  • src/index.ts:15-15 (registration)
    Top-level call to register all tools, including sign-message, in the main server initialization.
    registerTools(server, wagmiConfig);

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/Xiawpohr/metamask-mcp'

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