Skip to main content
Glama
cuongpo

Rootstock MCP Server

by cuongpo

import_wallet

Import an existing wallet into the Rootstock MCP Server using a private key or mnemonic phrase, with an optional name for wallet management.

Instructions

Import an existing wallet using private key or mnemonic phrase

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mnemonicNoMnemonic phrase to import (alternative to private key)
nameNoOptional name for the wallet
privateKeyNoPrivate key to import (alternative to mnemonic)

Implementation Reference

  • MCP tool handler for 'import_wallet': delegates to WalletManager.importWallet and returns formatted success response with wallet address.
    private async handleImportWallet(params: ImportWalletParams) {
      const walletInfo = this.walletManager.importWallet(
        params.privateKey,
        params.mnemonic,
        params.name
      );
      return {
        content: [
          {
            type: 'text',
            text: `Wallet imported successfully!\n\nAddress: ${walletInfo.address}`,
          },
        ],
      };
    }
  • src/index.ts:178-198 (registration)
    Registers the 'import_wallet' tool in the MCP server's tool list with description and JSON schema for inputs.
    {
      name: 'import_wallet',
      description: 'Import an existing wallet using private key or mnemonic phrase',
      inputSchema: {
        type: 'object',
        properties: {
          privateKey: {
            type: 'string',
            description: 'Private key to import (alternative to mnemonic)',
          },
          mnemonic: {
            type: 'string',
            description: 'Mnemonic phrase to import (alternative to private key)',
          },
          name: {
            type: 'string',
            description: 'Optional name for the wallet',
          },
        },
      },
    },
  • TypeScript interface defining input parameters for import_wallet tool (privateKey, mnemonic, name).
    export interface ImportWalletParams {
      privateKey?: string;
      mnemonic?: string;
      name?: string;
    }
  • Core wallet import logic: creates ethers.Wallet from privateKey or validated mnemonic, stores in manager, sets as current if first.
    importWallet(privateKey?: string, mnemonic?: string, _name?: string): WalletInfo {
      try {
        let wallet: ethers.Wallet | ethers.HDNodeWallet;
    
        if (privateKey) {
          wallet = new ethers.Wallet(privateKey);
        } else if (mnemonic) {
          if (!bip39.validateMnemonic(mnemonic)) {
            throw new Error('Invalid mnemonic phrase');
          }
          wallet = ethers.Wallet.fromPhrase(mnemonic);
        } else {
          throw new Error('Either private key or mnemonic must be provided');
        }
    
        // Store the wallet
        this.wallets.set(wallet.address.toLowerCase(), wallet);
        
        // Set as current wallet if it's the first one
        if (!this.currentWallet) {
          this.currentWallet = wallet.address.toLowerCase();
        }
    
        return {
          address: wallet.address,
          privateKey: wallet.privateKey,
          mnemonic,
          publicKey: 'publicKey' in wallet ? (wallet as any).publicKey : undefined,
        };
      } catch (error) {
        throw new Error(`Failed to import wallet: ${error}`);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('import') but doesn't cover critical aspects like whether this requires authentication, what happens to existing wallets, potential rate limits, error conditions, or the expected outcome (e.g., if the wallet becomes the current one). This is inadequate for a mutation tool with zero annotation coverage.

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 directly states the tool's purpose without any fluff. It's front-loaded with the core action and resources, making it easy to parse quickly. Every word earns its place.

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?

Given the complexity of a wallet import operation (a mutation with security implications), no annotations, and no output schema, the description is insufficient. It lacks details on behavioral traits, success/failure outcomes, and integration with sibling tools (e.g., whether the imported wallet becomes current). This leaves significant gaps for safe and effective use.

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, clearly documenting all three parameters (mnemonic, name, privateKey) and their relationships (alternatives). The description adds minimal value by mentioning 'private key or mnemonic phrase', which is already covered in the schema. Baseline 3 is appropriate since the schema does the heavy lifting.

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 verb ('import') and resource ('existing wallet') along with the specific methods ('using private key or mnemonic phrase'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'create_wallet', which creates a new wallet rather than importing an existing one.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. For example, it doesn't mention prerequisites (e.g., needing a private key or mnemonic), when to choose this over 'create_wallet', or any constraints like network compatibility. This leaves the agent without contextual usage cues.

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/cuongpo/rootstock-mcp'

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