Skip to main content
Glama

sign-message

Securely sign messages using MetaMask with MCPilot, enabling AI-driven blockchain interactions without exposing private keys. Simplify message signing for enhanced user onboarding.

Instructions

Sign messages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYes

Implementation Reference

  • Handler function that executes the signMessage using wagmi core, takes message from args, signs it with current account config, and returns the signature hash as text content.
    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 parameter 'message' as a string.
    parameters: z.object({ message: z.string(), }),
  • Function that registers the 'sign-message' tool with FastMCP server, including name, description, schema, and handler.
    export function registerSignMessageTools(server: FastMCP): void { server.addTool({ name: "sign-message", description: "Sign messages", parameters: z.object({ message: z.string(), }), 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; } }, }); };
  • Invocation of the registerSignMessageTools during server tool setup in the main entry point.
    registerSignMessageTools(server);

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/mcpilot'

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