Skip to main content
Glama

wallet_sign_transaction

Sign Ethereum and EVM-compatible blockchain transactions securely without broadcasting. Provide wallet details and transaction data to generate a signed transaction for offline use or later submission.

Instructions

Sign a transaction without sending it

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
transactionYesThe transaction to sign
walletNoThe wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set.

Implementation Reference

  • The main handler function that populates the transaction if needed and signs it using the Ethers.js Wallet instance.
    export const signTransactionHandler = async (input: any): Promise<ToolResultSchema> => {
      try {
        if (!input.transaction) {
          return createErrorResponse("Transaction is required");
        }
    
        const wallet = await getWallet(input.wallet, input.password);
    
        // For signing a transaction, we need to populate it first
        const populatedTx = await wallet.populateTransaction(input.transaction);
        const signedTx = await wallet.signTransaction(populatedTx);
    
        return createSuccessResponse(
        `Transaction signed successfully
          Signed transaction: ${signedTx}
        `);
      } catch (error) {
        return createErrorResponse(`Failed to sign transaction: ${(error as Error).message}`);
      }
    };
  • Defines the tool name, description, and input schema for 'wallet_sign_transaction' in the tools array.
    {
      name: "wallet_sign_transaction",
      description: "Sign a transaction without sending it",
      inputSchema: {
        type: "object",
        properties: {
          wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." },
          transaction: { 
            type: "object", 
            description: "The transaction to sign",
            properties: {
              to: { type: "string" },
              from: { type: "string" },
              data: { type: "string" },
              value: { type: "string" },
              gasLimit: { type: "string" },
              gasPrice: { type: "string" },
              nonce: { type: "number" },
              type: { type: "number" },
              maxFeePerGas: { type: "string" },
              maxPriorityFeePerGas: { type: "string" }
            },
            required: ["to"]
          }
        },
        required: ["transaction"]
      }
    },
  • src/tools.ts:579-581 (registration)
    Registers the signTransactionHandler function to the 'wallet_sign_transaction' tool name in the handlers dictionary.
    "wallet_send_transaction": sendTransactionHandler,
    "wallet_sign_transaction": signTransactionHandler,
    "wallet_populate_transaction": populateTransactionHandler,
  • src/tools.ts:16-37 (registration)
    Imports the signTransactionHandler from the handlers module.
      signTransactionHandler,
      populateTransactionHandler,
      signMessageHandler,
      signTypedDataHandler,
      verifyMessageHandler,
      verifyTypedDataHandler,
      getBlockHandler,
      getTransactionHandler,
      getTransactionReceiptHandler,
      getCodeHandler,
      getStorageAtHandler,
      estimateGasHandler,
      getLogsHandler,
      getEnsResolverHandler,
      lookupAddressHandler,
      resolveNameHandler,
      getNetworkHandler,
      getBlockNumberHandler,
      getFeeDataHandler,
      createMnemonicPhraseHandler,
      setProviderHandler
    } from "./handlers/wallet.js";
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool signs but doesn't send, which is useful. However, it lacks critical information: what permissions are needed, whether this is a read-only or mutating operation, what format the signed transaction takes, or any security implications. For a signing tool with zero annotation coverage, this is insufficient.

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 is a single, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized and front-loaded with the essential information.

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

Completeness2/5

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

For a transaction signing tool with no annotations and no output schema, the description is inadequate. It doesn't explain what the tool returns (signed transaction format), what happens on failure, security requirements, or how the signing interacts with the wallet parameter. The context signals show complexity (nested objects, 2 parameters), but the description doesn't address this complexity.

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 description coverage is 100%, so the schema fully documents both parameters. The description doesn't add any parameter-specific information beyond what's in the schema. The baseline score of 3 is appropriate when the schema does all the parameter documentation work.

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 a transaction') and distinguishes it from sending operations. It specifies 'without sending it' which differentiates it from sibling tools like wallet_send_transaction. However, it doesn't explicitly contrast with other signing tools like wallet_sign_message or wallet_sign_typed_data.

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 description implies usage context by stating 'without sending it', suggesting this is for preparing transactions rather than executing them. However, it doesn't provide explicit guidance on when to use this versus wallet_send_transaction or other signing alternatives. No prerequisites or exclusions are mentioned.

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

Related 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/dcSpark/mcp-cryptowallet-evm'

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