Skip to main content
Glama

Import a key from a file

crypto_key_import

Import PKCS#8 private keys or raw 32-byte symmetric/HMAC keys from a server-approved file and get an opaque handle that keeps key material inside the service.

Instructions

Import an existing key from a file in the directory the server operator set in CRYPTO_MCP_KEY_DIR (disabled when it is unset). Reads an unencrypted PKCS#8 PEM private key (Ed25519, RSA 2048/3072/4096, ECDSA P-256/P-384/secp256k1; the type comes from the key) or a raw 32-byte key, as 32 binary bytes or 64 hex digits, imported as 'symmetric-256' (default) or 'hmac-sha256'. Files over 65536 bytes are refused. The key bytes never pass through the conversation. Secret key material stays inside the server; only an opaque keyHandle is returned.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "crypto_key_import"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNoFor a raw 32-byte key only: 'symmetric-256' (crypto_encrypt, crypto_decrypt, crypto_kms_wrap; default) or 'hmac-sha256' (crypto_sign, crypto_verify).
pathYesPath of the key file, relative to CRYPTO_MCP_KEY_DIR. Absolute paths, '..' segments and symlinks that lead outside the directory are refused.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.41

TDQS

A4.5/5.0
Behavior4/5

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

Adds substantial behavior beyond the annotations: the 65536-byte file size cap, the disabled-when-unset precondition, and the security guarantee that key bytes never traverse the conversation and only an opaque keyHandle is returned. It stops short of describing what happens on re-import of the same file (consistent with idempotentHint=false) or whether the handle has a lifetime.

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?

Front-loads what the tool does and the enablement condition, then packs format, size, and security details into compact parenthetical lists. Every sentence carries information an agent needs; nothing is filler.

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

Completeness5/5

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

For a two-parameter import tool with no output schema, the definition covers prerequisites, accepted inputs, rejection conditions, and the return value (opaque keyHandle). Nothing essential for correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters are documented structurally; the description nevertheless adds the non-obvious rule that for PEM files the key type is derived from the key itself, so 'kind' applies only to raw 32-byte input, and clarifies the raw-key encodings (32 binary bytes or 64 hex digits).

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 a specific verb and resource ('Import an existing key from a file') and enumerates the accepted formats (PKCS#8 PEM: Ed25519/RSA/ECDSA; raw 32-byte key), which cleanly separates it from crypto_generate_key. An agent knows this is for bringing an existing key into the server, not creating one.

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

Usage Guidelines4/5

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

Gives clear situational context: usable only when CRYPTO_MCP_KEY_DIR is set, and applicable to existing key files, with the raw-key path optionally typed via 'kind'. It does not explicitly name crypto_generate_key as the alternative for keys that don't exist yet, leaving that inference to the reader.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.