Skip to main content
Glama

sign_message

Generate cryptographic signatures for messages or EIP-712 typed data to verify authenticity and integrity in blockchain transactions.

Instructions

Sign a message (personal_sign) or EIP-712 typed data (signTypedData). Returns the signature. EIP-712 is EVM-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageNoMessage to sign (hex 0x-prefixed or UTF-8 string). Required for sign_type "personal".
sign_typeNoSign type: "personal" (default) for raw message, "typedData" for EIP-712.
typed_dataNoEIP-712 typed data structure. Required when sign_type is "typedData".
networkNoTarget network (optional).
wallet_idNoTarget wallet ID. Required for multi-wallet sessions.

Implementation Reference

  • The tool handler logic that prepares the API request body and calls the sign-message endpoint.
        async (args) => {
          const body: Record<string, unknown> = {};
          if (args.message) body.message = args.message;
          if (args.sign_type) body.signType = args.sign_type;
          if (args.typed_data) body.typedData = args.typed_data;
          if (args.network) body.network = args.network;
          if (args.wallet_id) body.walletId = args.wallet_id;
          const result = await apiClient.post('/v1/transactions/sign-message', body);
          return toToolResult(result);
        },
      );
    }
  • The Zod schema validation definition for the 'sign_message' tool arguments.
    {
      message: z.string().optional().describe('Message to sign (hex 0x-prefixed or UTF-8 string). Required for sign_type "personal".'),
      sign_type: z.enum(['personal', 'typedData']).optional().describe('Sign type: "personal" (default) for raw message, "typedData" for EIP-712.'),
      typed_data: z.object({
        domain: z.object({
          name: z.string().optional(),
          version: z.string().optional(),
          chainId: z.union([z.number(), z.string()]).optional(),
          verifyingContract: z.string().optional(),
          salt: z.string().optional(),
        }),
        types: z.record(z.array(z.object({ name: z.string(), type: z.string() }))),
        primaryType: z.string(),
        message: z.record(z.unknown()),
      }).optional().describe('EIP-712 typed data structure. Required when sign_type is "typedData".'),
      network: z.string().optional().describe('Target network (optional).'),
      wallet_id: z.string().optional().describe('Target wallet ID. Required for multi-wallet sessions.'),
    },
  • Registration function that registers the 'sign_message' tool on the MCP server.
    export function registerSignMessage(
      server: McpServer,
      apiClient: ApiClient,
      walletContext?: WalletContext,
    ): void {
      server.tool(
        'sign_message',
        withWalletPrefix(
          'Sign a message (personal_sign) or EIP-712 typed data (signTypedData). Returns the signature. EIP-712 is EVM-only.',
          walletContext?.walletName,
        ),
        {
          message: z.string().optional().describe('Message to sign (hex 0x-prefixed or UTF-8 string). Required for sign_type "personal".'),
          sign_type: z.enum(['personal', 'typedData']).optional().describe('Sign type: "personal" (default) for raw message, "typedData" for EIP-712.'),
          typed_data: z.object({
            domain: z.object({
              name: z.string().optional(),
              version: z.string().optional(),
              chainId: z.union([z.number(), z.string()]).optional(),
              verifyingContract: z.string().optional(),
              salt: z.string().optional(),
            }),
            types: z.record(z.array(z.object({ name: z.string(), type: z.string() }))),
            primaryType: z.string(),
            message: z.record(z.unknown()),
          }).optional().describe('EIP-712 typed data structure. Required when sign_type is "typedData".'),
          network: z.string().optional().describe('Target network (optional).'),
          wallet_id: z.string().optional().describe('Target wallet ID. Required for multi-wallet sessions.'),
        },
        async (args) => {
          const body: Record<string, unknown> = {};
          if (args.message) body.message = args.message;
          if (args.sign_type) body.signType = args.sign_type;
          if (args.typed_data) body.typedData = args.typed_data;
          if (args.network) body.network = args.network;
          if (args.wallet_id) body.walletId = args.wallet_id;
          const result = await apiClient.post('/v1/transactions/sign-message', body);
          return toToolResult(result);
        },
      );
    }

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/minhoyoo-iotrust/WAIaaS'

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