Skip to main content
Glama
getpara
by getpara

sign_raw

Sign arbitrary data using Multi-Party Computation (MPC) with a ready Para Wallet. Accepts 0x-prefixed hex strings and returns cryptographic signatures for secure blockchain operations.

Instructions

Sign arbitrary data with a wallet via MPC. The data must be a 0x-prefixed hex string. The wallet must be in "ready" status. Returns the signature.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletIdYesThe wallet ID to sign with
dataYesData to sign as a 0x-prefixed hex string (e.g. "0x48656c6c6f")

Implementation Reference

  • The handler function for the 'sign_raw' tool, which processes arguments, validates input format, and calls the API.
    export async function handler(client: ParaClient, args: Record<string, unknown>) {
      const walletId = args.walletId as string;
      const data = args.data as string;
    
      if (!data.startsWith('0x') || !/^0x[0-9a-fA-F]+$/.test(data)) {
        return {
          content: [
            {
              type: 'text' as const,
              text: 'Error: data must be a 0x-prefixed hex string (e.g. "0x48656c6c6f"). To sign a UTF-8 string, first convert it to hex.',
            },
          ],
          isError: true,
        };
      }
    
      const result = await client.requestWithRetry<SignRawResponse>(
        `/v1/wallets/${walletId}/sign-raw`,
        { method: 'POST', body: { data } },
      );
    
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • The MCP definition object for 'sign_raw', including its name, description, and input schema.
    export const definition = {
      name: 'sign_raw',
      description:
        'Sign arbitrary data with a wallet via MPC. The data must be a 0x-prefixed hex string. The wallet must be in "ready" status. Returns the signature.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          walletId: {
            type: 'string',
            description: 'The wallet ID to sign with',
          },
          data: {
            type: 'string',
            description: 'Data to sign as a 0x-prefixed hex string (e.g. "0x48656c6c6f")',
          },
        },
        required: ['walletId', 'data'],
      },
    };
  • Zod schema definitions for 'sign_raw' request and response types.
    export const SignRawRequestSchema = z.object({
      data: z.string().regex(/^0x[0-9a-fA-F]+$/, 'data must be a 0x-prefixed hex string'),
    });
    export type SignRawRequest = z.infer<typeof SignRawRequestSchema>;
    
    export const SignRawResponseSchema = z.object({
      signature: z.string(),
    });
    export type SignRawResponse = z.infer<typeof SignRawResponseSchema>;
  • src/index.ts:30-30 (registration)
    The registration of the 'sign_raw' tool into the main tool list array.
    const tools = [createWallet, getWallet, signRaw, listWallets, waitForWallet];

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/getpara/para-wallet-mcp'

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