Skip to main content
Glama

verify-message

Verify that a message was signed by a specific Ethereum address using its signature to confirm authenticity and prevent tampering.

Instructions

Verify that a message was signed by the provided address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesThe Ethereum address that signed the original message.
messageYesThe message to be verified.
signatureYesThe signature that was generated by signing the message with the address's signer.

Implementation Reference

  • The execute handler that verifies the signed message using wagmi's verifyMessage function and returns the result as text content.
    execute: async (args) => { const result = await verifyMessage(wagmiConfig, args); return { content: [ { type: "text", text: result.toString(), }, ], }; },
  • Input schema defining parameters for address, message, and signature using Zod and imported types.
    parameters: z.object({ address: Address.describe("The Ethereum address that signed the original message."), message: z.string().describe("The message to be verified."), signature: Signature.describe("The signature that was generated by signing the message with the address's signer."), }),
  • Registration of the verify-message tool on the FastMCP server, including name, description, schema, and handler.
    export function registerVerifyMessageTools(server: FastMCP, wagmiConfig: Config): void { server.addTool({ name: "verify-message", description: "Verify that a message was signed by the provided address.", parameters: z.object({ address: Address.describe("The Ethereum address that signed the original message."), message: z.string().describe("The message to be verified."), signature: Signature.describe("The signature that was generated by signing the message with the address's signer."), }), execute: async (args) => { const result = await verifyMessage(wagmiConfig, args); return { content: [ { type: "text", text: result.toString(), }, ], }; }, }); };
  • Invocation of registerVerifyMessageTools in the central tool registration function.
    registerVerifyMessageTools(server, wagmiConfig);
  • Zod schema validator for signature strings used in verify-message tool parameters.
    export const Signature = z.string().transform((val, ctx) => { const regex = /^0x[a-fA-F0-9]+$/; if (!regex.test(val)) { ctx.addIssue({ code: z.ZodIssueCode.custom, message: `Invalid Signature ${val}`, }); } return val as BytesType; });

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