Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

zetrix_crypto_encrypt_key

Encrypt private keys with passwords for secure storage on the Zetrix blockchain, protecting sensitive cryptographic data from unauthorized access.

Instructions

Encrypt a private key with a password for secure storage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
privateKeyYesThe private key to encrypt
passwordYesThe password to use for encryption

Implementation Reference

  • src/index.ts:623-640 (registration)
    Tool registration in the MCP tools list, including name, description, and input schema definition
    {
      name: "zetrix_crypto_encrypt_key",
      description: "Encrypt a private key with a password for secure storage",
      inputSchema: {
        type: "object",
        properties: {
          privateKey: {
            type: "string",
            description: "The private key to encrypt",
          },
          password: {
            type: "string",
            description: "The password to use for encryption",
          },
        },
        required: ["privateKey", "password"],
      },
    },
  • MCP server request handler for the tool. Validates arguments and delegates to ZetrixEncryption.encryptPrivateKey, formats response
    case "zetrix_crypto_encrypt_key": {
      if (!args) {
        throw new Error("Missing arguments");
      }
      const encryptedData = await zetrixEncryption.encryptPrivateKey(
        args.privateKey as string,
        args.password as string
      );
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({ encryptedData }, null, 2),
          },
        ],
      };
    }
  • Core implementation of private key encryption using the official zetrix-encryption-nodejs library's keystore.encrypt method, wrapped in Promise for async/await compatibility
    /**
     * Encrypt a private key with a password (uses callbacks, wrapped in Promise)
     * @param privateKey - The private key to encrypt
     * @param password - The password to use for encryption
     * @returns Encrypted keystore data (object that can be passed to decrypt)
     */
    async encryptPrivateKey(
      privateKey: string,
      password: string
    ): Promise<any> {
      await this.initEncryption();
    
      return new Promise((resolve, reject) => {
        try {
          this.keystore.encrypt(privateKey, password, (result: any) => {
            if (result) {
              // The library returns an object with encrypted data
              // Return as-is for decrypt to consume
              resolve(result);
            } else {
              reject(new Error("Encryption failed: No data returned"));
            }
          });
        } catch (error) {
          reject(
            new Error(
              `Failed to encrypt private key: ${error instanceof Error ? error.message : String(error)}`
            )
          );
        }
      });
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool encrypts a private key with a password for secure storage, which implies a write/mutation operation but lacks details on encryption algorithm, security implications, error conditions, or output format. For a cryptographic tool with zero annotation coverage, this is insufficient behavioral disclosure.

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 unnecessary words. It is front-loaded with the core action and purpose, making it easy to parse quickly.

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 cryptographic encryption tool with no annotations and no output schema, the description is incomplete. It lacks critical context such as the encryption method, security warnings, expected output (e.g., encrypted key format), or error handling, which are essential 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?

Schema description coverage is 100%, with clear descriptions for both parameters ('privateKey' and 'password'). The description adds no additional parameter semantics beyond what the schema provides, such as format requirements (e.g., key encoding, password strength) or examples. Baseline 3 is appropriate when 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 action ('encrypt') and target ('private key') with the purpose ('for secure storage'). It distinguishes from siblings like 'zetrix_crypto_decrypt_key' by specifying encryption rather than decryption. However, it doesn't explicitly differentiate from other key-related tools like 'zetrix_crypto_generate_keypair' or 'zetrix_crypto_validate_key' beyond the encryption focus.

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. It doesn't mention prerequisites (e.g., needing a private key from generation or import), when not to use it (e.g., if key is already encrypted), or direct comparisons to siblings like 'zetrix_crypto_decrypt_key' for reverse operations.

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/Zetrix-Chain/zetrix-mcp-server'

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