Skip to main content
Glama
lordbasilaiassistant-sudo

base-multi-wallet-mcp

import_wallet

Import an existing wallet using a private key for session-based access to coordinated trading operations on Base.

Instructions

Import an existing wallet by private key. Key is stored in-memory for session only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
private_keyYesPrivate key to import (hex, with or without 0x prefix)
labelNoOptional name/label for the wallet

Implementation Reference

  • The `handleImportWallet` function takes a private key and optional label, creates an ethers Wallet instance, ensures it is not a duplicate, and adds it to the managed `wallets` array.
    async function handleImportWallet(
      args: z.infer<typeof ImportWalletSchema>
    ): Promise<string> {
      let key = args.private_key;
      if (!key.startsWith("0x")) key = "0x" + key;
    
      try {
        const w = new ethers.Wallet(key);
        const label = args.label || `imported-${wallets.length + 1}`;
    
        // Check for duplicates
        if (wallets.some((mw) => mw.address.toLowerCase() === w.address.toLowerCase())) {
          return JSON.stringify({ success: false, error: "Wallet already exists in pool" });
        }
    
        wallets.push({
          address: w.address,
          privateKey: w.privateKey,
          label,
        });
    
        return JSON.stringify(
          {
            success: true,
            address: w.address,
            label,
            total_managed: wallets.length,
          },
          null,
          2
        );
      } catch {
        return JSON.stringify({ success: false, error: "Invalid private key" });
      }
  • The `ImportWalletSchema` defines the expected input format for the `import_wallet` tool using Zod, requiring a `private_key` string and an optional `label`.
    const ImportWalletSchema = z.object({
      private_key: z.string().describe("Private key to import (hex, with or without 0x prefix)"),
      label: z.string().optional().describe("Optional name/label for the wallet"),
    });
  • src/index.ts:776-785 (registration)
    The `import_wallet` tool is registered in the tool list, providing its name, description, and input schema reference.
    name: "import_wallet",
    description:
      "Import an existing wallet by private key. Key is stored in-memory for session only.",
    inputSchema: {
      type: "object" as const,
      properties: {
        private_key: {
          type: "string",
          description: "Private key to import (hex, with or without 0x prefix)",
        },
Behavior4/5

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

No annotations provided, so description carries full burden. Critically discloses that the key is 'stored in-memory for session only'—essential security context. However, misses return value description, error handling, and whether this replaces current session wallet or adds to a list.

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 with zero waste. Front-loaded with action ('Import an existing wallet'), followed by critical security constraint. Every word earns its place.

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?

Adequate for a 2-parameter tool with complete schema coverage, given the security-critical storage disclosure. However, lacks description of return value (address? object?) and error cases (invalid key format?), which would be helpful given no output schema exists.

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 has 100% description coverage (hex format, optional label), establishing baseline 3. Description adds storage semantics for private_key ('in-memory for session only'), but does not expand on validation rules or label uniqueness constraints.

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?

States specific verb (import), resource (wallet), and mechanism (by private key). 'Existing' clearly distinguishes from sibling 'create_wallet' which generates new wallets.

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?

Implies usage via 'existing wallet' (contrasting with create_wallet), but lacks explicit when-to-use guidance or prerequisites. Session-only storage hint suggests temporary use cases, but no explicit comparison to alternatives.

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/lordbasilaiassistant-sudo/base-multi-wallet-mcp'

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