Skip to main content
Glama

sign_userop

Sign a completed UserOperation with gas and paymaster fields. Returns the signed operation with signature and a tracking transaction ID.

Instructions

Sign a completed UserOperation (with gas/paymaster fields). Returns signed UserOperation with signature and txId for tracking.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wallet_idYesSmart Account wallet ID (UUID).
build_idYesBuild ID from build_userop response.
senderYesSmart Account address (0x hex).
nonceYesAccount nonce (0x hex).
call_dataYesEncoded call data (0x hex).
call_gas_limitYesGas limit for call execution (0x hex).
verification_gas_limitYesGas limit for verification (0x hex).
pre_verification_gasYesPre-verification gas (0x hex).
max_fee_per_gasYesMax fee per gas (0x hex).
max_priority_fee_per_gasYesMax priority fee per gas (0x hex).
signatureNoPlaceholder signature (0x hex). Default: 0x.
factoryNoFactory address for undeployed accounts.
factory_dataNoFactory data for undeployed accounts.
paymasterNoPaymaster address.
paymaster_dataNoPaymaster data.
paymaster_verification_gas_limitNoPaymaster verification gas limit.
paymaster_post_op_gas_limitNoPaymaster post-op gas limit.

Implementation Reference

  • The handler function that executes the sign_userop tool logic. It constructs a UserOperation object from the input args, makes a POST request to /v1/wallets/:id/userop/sign, and returns the result.
        async (args) => {
          const userOperation: Record<string, unknown> = {
            sender: args.sender,
            nonce: args.nonce,
            callData: args.call_data,
            callGasLimit: args.call_gas_limit,
            verificationGasLimit: args.verification_gas_limit,
            preVerificationGas: args.pre_verification_gas,
            maxFeePerGas: args.max_fee_per_gas,
            maxPriorityFeePerGas: args.max_priority_fee_per_gas,
            signature: args.signature ?? '0x',
          };
          if (args.factory) userOperation.factory = args.factory;
          if (args.factory_data) userOperation.factoryData = args.factory_data;
          if (args.paymaster) userOperation.paymaster = args.paymaster;
          if (args.paymaster_data) userOperation.paymasterData = args.paymaster_data;
          if (args.paymaster_verification_gas_limit) userOperation.paymasterVerificationGasLimit = args.paymaster_verification_gas_limit;
          if (args.paymaster_post_op_gas_limit) userOperation.paymasterPostOpGasLimit = args.paymaster_post_op_gas_limit;
          const body = { buildId: args.build_id, userOperation };
          const result = await apiClient.post(
            `/v1/wallets/${args.wallet_id}/userop/sign`,
            body,
          );
          return toToolResult(result);
        },
      );
    }
  • Zod schema defining the input parameters for sign_userop: wallet_id, build_id, sender, nonce, call_data, gas fields, signature, factory, factory_data, and optional paymaster fields.
    {
      wallet_id: z.string().describe('Smart Account wallet ID (UUID).'),
      build_id: z.string().describe('Build ID from build_userop response.'),
      sender: z.string().describe('Smart Account address (0x hex).'),
      nonce: z.string().describe('Account nonce (0x hex).'),
      call_data: z.string().describe('Encoded call data (0x hex).'),
      call_gas_limit: z.string().describe('Gas limit for call execution (0x hex).'),
      verification_gas_limit: z.string().describe('Gas limit for verification (0x hex).'),
      pre_verification_gas: z.string().describe('Pre-verification gas (0x hex).'),
      max_fee_per_gas: z.string().describe('Max fee per gas (0x hex).'),
      max_priority_fee_per_gas: z.string().describe('Max priority fee per gas (0x hex).'),
      signature: z.string().optional().describe('Placeholder signature (0x hex). Default: 0x.'),
      factory: z.string().optional().describe('Factory address for undeployed accounts.'),
      factory_data: z.string().optional().describe('Factory data for undeployed accounts.'),
      paymaster: z.string().optional().describe('Paymaster address.'),
      paymaster_data: z.string().optional().describe('Paymaster data.'),
      paymaster_verification_gas_limit: z.string().optional().describe('Paymaster verification gas limit.'),
      paymaster_post_op_gas_limit: z.string().optional().describe('Paymaster post-op gas limit.'),
    },
  • Registration of the sign_userop tool via registerSignUserop(server, apiClient, walletContext) in the MCP server setup.
    registerSignUserop(server, apiClient, walletContext);
  • TypeScript interfaces defining the SignUserOpParams (buildId + userOperation) and SignUserOpResponse (signedUserOperation + txId) types used in the SDK.
    export interface SignUserOpParams {
      buildId: string;
      userOperation: Record<string, unknown>;
    }
    
    export interface SignUserOpResponse {
      signedUserOperation: Record<string, unknown>;
      txId: string;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must fully disclose behavior. It states it returns signed UserOp with signature and txId, but does not discuss side effects, permissions, or whether it modifies state. Adequate but not thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with action and key output. No unnecessary words, every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite 17 parameters and no output schema, the description is brief. It mentions return type (signed UserOp with signature and txId) but lacks explanation of txId or constraints. Schema descriptions are thorough, so it meets minimum viability.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers 100% of parameters with descriptions. Description mentions 'gas/paymaster fields' but adds no additional meaning beyond the schema. Baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb (Sign), resource (completed UserOperation with gas/paymaster fields), and output (signed UserOperation with signature and txId). It distinguishes from sibling tools like build_userop, sign_message, and sign_transaction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description implies it should be used after building the UserOperation, but does not explicitly state when not to use or mention alternatives like sign_message or sign_transaction. Context is clear but lacks exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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