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
| Name | Required | Description | Default |
|---|---|---|---|
| walletId | Yes | The wallet ID to sign with | |
| data | Yes | Data to sign as a 0x-prefixed hex string (e.g. "0x48656c6c6f") |
Implementation Reference
- src/tools/sign-raw.ts:24-53 (handler)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), }, ], }; } - src/tools/sign-raw.ts:4-22 (schema)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'], }, }; - src/types.ts:52-60 (schema)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];