Skip to main content
Glama

sign_userop

Sign a completed UserOperation with gas and paymaster fields to authorize blockchain transactions from smart accounts, returning a signed operation with signature and transaction ID for tracking.

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

  • Tool registration and handler implementation for sign_userop.
    export function registerSignUserop(
      server: McpServer,
      apiClient: ApiClient,
      walletContext?: WalletContext,
    ): void {
      server.tool(
        'sign_userop',
        withWalletPrefix(
          'Sign a completed UserOperation (with gas/paymaster fields). Returns signed UserOperation with signature and txId for tracking.',
          walletContext?.walletName,
        ),
        {
          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.'),
        },
        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);
        },
      );
    }
  • Handler logic for sign_userop tool which maps arguments to a request body and sends it to the API.
    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);
    },
Behavior3/5

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

With no annotations provided, the description must carry the full burden. It discloses the return values (signature and txId) which compensates somewhat for the lack of output schema, but it lacks critical safety context: it does not clarify whether this submits to chain, modifies wallet state, requires authentication, or if it is idempotent.

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?

The description consists of two efficient sentences: one describing the input/operation and one describing the return value. There is no redundancy or waste, and the structure appropriately front-loads the core action.

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?

Given this is a complex ERC-4337 Account Abstraction tool with 17 parameters and no output schema, the description provides the basics (action and return type) but omits workflow context (relationship to build_userop) and safety characteristics that would be necessary for robust agent usage.

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?

The input schema has 100% description coverage, so the schema already fully documents all 17 parameters. The description adds minimal semantic value beyond the schema, only highlighting that gas/paymaster fields are relevant, which aligns with the parameter presence.

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

Purpose4/5

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

The description clearly states the action ('Sign') and target ('completed UserOperation'), including specific context about gas/paymaster fields. However, it does not explicitly distinguish this from sibling tools like sign_message or sign_transaction, which is important given the similar naming in the sibling list.

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

Usage Guidelines3/5

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

The phrase 'completed UserOperation' implies a workflow sequence (likely following build_userop), but there is no explicit guidance on when to use this versus sign_transaction or sign_message, nor does it mention the prerequisite of having built the operation first.

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