Skip to main content
Glama

CipherHUB Cryptography Toolkit

ml_kem_keygen

[pqc_kem] 生成 ML-KEM 密钥对(FIPS 203,后量子密钥封装标准)。 【算法选择】ML-KEM-512(NIST Level 1)/ ML-KEM-768(Level 3,推荐)/ ML-KEM-1024(Level 5)。 【参数】

  • algorithm:算法名

  • seed_in_hex:可选,64 字节种子 hex(128 字符)。填入时按该种子确定性生成

  • use_random_seed:可选。true 强制随机并忽略 seed_in_hex;false 必须提供 seed_in_hex;不传时按 seed_in_hex 是否为空决定:空则随机,非空则确定性 【输出】public_key_in_hex、public_key_in_base64、secret_key_in_hex、secret_key_in_base64、seed_in_hex、algorithm、nist_level、public_key_bytes、secret_key_bytes。 【后续操作】公钥用于 ml_kem_encap,私钥用于 ml_kem_decap。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "ml_kem_keygen"
  }
}

Input Schema

NameRequiredDescriptionDefault
algorithmNo密码算法名称(具体可选值因工具而异,见工具描述)ML-KEM-768
seed_in_hexNoML-KEM 密钥生成种子的十六进制字符串,可选。留空时由服务端随机生成;填写时必须为 128 个 hex 字符(64 字节)
use_random_seedNo可选。true 强制随机并忽略 seed_in_hex;false 必须提供 seed_in_hex;不传时按 seed_in_hex 是否为空决定:空则随机,非空则确定性

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / seed_in_hex / description
      Previous value: -"ML-KEM 密钥生成种子的十六进制字符串,固定 128 个 hex 字符(64 字节)"New value: +"ML-KEM 密钥生成种子的十六进制字符串,可选。留空时由服务端随机生成;填写时必须为 128 个 hex 字符(64 字节)"
    • addedInput schema / properties / seed_in_hex / maxLength
      Added value: +128
    • addedInput schema / properties / seed_in_hex / pattern
      Added value: +"^([0-9a-fA-F]{2})*$"
    • changedInput schema / properties / use_random_seed / description
      Previous value: -"True 时忽略 seed_in_hex,使用 CSPRNG 随机生成种子"New value: +"可选。true 强制随机并忽略 seed_in_hex;false 必须提供 seed_in_hex;不传时按 seed_in_hex 是否为空决定:空则随机,非空则确定性"
  2. Changed4 schema fields changed
    • changedInput schema / properties / seed_in_hex / default
      Previous value: -"30313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233"New value: +""
    • addedInput schema / properties / use_random_seed / anyOf
      Added value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / use_random_seed / default
      Previous value: -falseNew value: +null
    • removedInput schema / properties / use_random_seed / type
      Removed value: -"boolean"
  3. Changed4 schema fields changed
    • addedInput schema / properties / algorithm / description
      Added value: +"密码算法名称(具体可选值因工具而异,见工具描述)"
    • addedInput schema / properties / algorithm / enum
      Added value: +[
      +  "ML-KEM-512",
      +  "ML-KEM-768",
      +  "ML-KEM-1024"
      +]
    • addedInput schema / properties / seed_in_hex / description
      Added value: +"ML-KEM 密钥生成种子的十六进制字符串,固定 128 个 hex 字符(64 字节)"
    • addedInput schema / properties / use_random_seed / description
      Added value: +"True 时忽略 seed_in_hex,使用 CSPRNG 随机生成种子"
  4. First observed

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden and does disclose the non-obvious trait that matters most here: determinism is controlled by seed_in_hex and the precedence rule for use_random_seed. It also enumerates the full return payload, compensating for the absent output schema. It does not discuss secret-key handling sensitivity or any server-side constraints, which keeps it below a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The bracketed section headers (算法选择 / 参数 / 输出 / 后续操作) front-load the important choices and make scanning easy. Some sentences in the 参数 block duplicate the JSON schema descriptions verbatim, which is wasted space, but overall density is reasonable for a 3-parameter tool.

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

Completeness4/5

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

Since no output schema exists, the description's explicit list of returned fields (public/secret key in hex and base64, seed, nist_level, byte lengths) is exactly the right compensation and makes the tool callable end-to-end. What it omits is whether the secret key is retrievable again later or how errors surface, which are minor for a keygen primitive.

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 coverage is 100%, so the baseline is 3, and most of the description's parameter block restates what the schema already documents. The one genuine addition is mapping each algorithm enum value to its NIST security level, which the schema enum does not convey.

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?

The description states a specific verb and resource ('生成 ML-KEM 密钥对') and anchors it to the FIPS 203 standard, which lets an agent separate it cleanly from ml_dsa_keygen (signatures) and from ml_kem_encap/ml_kem_decap (which consume the output). The bracketed '[pqc_kem]' prefix and the enumerated algorithm variants make the scope unambiguous.

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?

It gives real selection guidance for the algorithm parameter (ML-KEM-768 flagged as 推荐/Level 3) and explicitly routes the agent forward to ml_kem_encap for the public key and ml_kem_decap for the secret key. It stops short of saying when to prefer this over other key-generation siblings such as generate_ecc or hybrid_kex, but for a single-purpose primitive the context is clear.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.