Skip to main content
Glama

CipherHUB Cryptography Toolkit

ml_kem_encap

Read-only

[pqc_kem] 使用 ML-KEM 公钥执行密钥封装(FIPS 203)。 【算法】ML-KEM-512 / ML-KEM-768 / ML-KEM-1024。 【参数】

  • algorithm:必须与 keygen 时一致

  • public_key_in_hex:ml_kem_keygen 返回的公钥 hex 【输出】ciphertext_in_hex、ciphertext_in_base64、shared_secret_in_hex、shared_secret_in_base64、shared_secret_sha256、ciphertext_bytes、shared_secret_bytes、algorithm。 【说明】每次 encap 产生不同密文(随机化),共享密钥始终 32 字节。发送 ciphertext 给密钥持有方,对方用 ml_kem_decap 恢复相同的 shared_secret。

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_encap"
  }
}

Input Schema

NameRequiredDescriptionDefault
algorithmNo密码算法名称(具体可选值因工具而异,见工具描述)ML-KEM-768
public_key_in_hexNo公钥的十六进制字符串(裸密钥或 DER 编码,取决于算法)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 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 / public_key_in_hex / description
      Added value: +"公钥的十六进制字符串(裸密钥或 DER 编码,取决于算法)"
  2. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the description's added value is its disclosure that each encapsulation is randomized (different ciphertext every call) while the shared secret is always 32 bytes. That is genuine behavioral context an agent could not infer from structured fields. It does not cover failure modes such as a malformed or wrong-length public key, which keeps it from 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?

Front-loaded with the action, then bracketed sections for algorithm, parameters, outputs, and notes, so it is scannable and wastes little space. The output list is long but justified because no output schema exists to carry it.

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?

With only two parameters, no output schema, and thin annotations, the description supplies what the structured data omits: the full return field list (ciphertext and shared secret in hex/base64 plus hashes and byte lengths), the algorithm pairing constraint, and the decapsulation handoff. An agent has everything needed to call it and interpret the result.

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%, so the schema already documents both parameters and the baseline is 3. The description does add a real constraint not in the schema (algorithm must match the keygen call) and ties public_key_in_hex to ml_kem_keygen output, which is modestly useful beyond the schema text.

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?

Opens with a specific verb+resource: perform key encapsulation with an ML-KEM public key (FIPS 203). It also scopes the algorithm family (ML-KEM-512/768/1024), which cleanly separates it from the sibling ml_kem_decap and ml_kem_keygen operations.

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 a concrete workflow: the algorithm must match the one used at keygen, and the public key comes from ml_kem_keygen; the ciphertext is sent to the key holder who calls ml_kem_decap. That is clear when-to-use and names the correct alternative for the counterpart step, though it offers no explicit exclusions (e.g. not for signing or symmetric encryption).

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.