Skip to main content
Glama

Encapsulate a shared secret

crypto_kem_encapsulate

Encapsulate a shared secret to an ML-KEM (FIPS 203) public key and receive the KEM ciphertext plus a symmetric-256 key handle for use with crypto_encrypt.

Instructions

Encapsulate a shared secret to an ML-KEM (FIPS 203) public key (512, 768, 1024). Returns the KEM ciphertext for the recipient and a symmetric-256 keyHandle for the shared secret, usable with crypto_encrypt. 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": {
      "publicKey": "<publicKey>"
    },
    "name": "crypto_kem_encapsulate"
  }
}

Input Schema

NameRequiredDescriptionDefault
levelNoML-KEM security level (512, 768, or 1024). Default is 768.
publicKeyYesHex-encoded ML-KEM public key (1600, 2368, or 3136 hex characters).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.41

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint=false, destructiveHint=false, idempotentHint=false, openWorldHint=false), so the bar is lower. The description nonetheless adds meaningful context beyond them: secret key material never leaves the server and only an opaque keyHandle is returned, which tells the agent how to handle the result. It omits anything about ciphertext format or keyHandle lifetime, keeping 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.

Conciseness5/5

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

Three tight sentences: operation first, outputs second, security invariant last. No filler, no restatement of the title, and the most decision-relevant information leads.

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?

With no output schema, the description carries the burden of describing return values and does so: the KEM ciphertext and a symmetric-256 keyHandle. Combined with the disclosure that key material stays server-side, an agent has enough to call the tool and use the result, though ciphertext size or transport expectations are unstated.

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 both publicKey (hex, length constraints) and level (enum with default 768) are already documented in the schema. The description repeats the level values (512, 768, 1024) but adds no encoding, format, or matching requirements beyond what the schema states. Baseline 3 is correct.

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 pairs the specific verb 'Encapsulate' with the resource 'a shared secret to an ML-KEM (FIPS 203) public key' and enumerates the supported levels, which pins down the operation precisely. It also names the outputs (KEM ciphertext, keyHandle), implicitly separating it from crypto_kem_decapsulate and the hybrid variants. It never explicitly contrasts itself with the sibling encapsulate tools, so it stops short of a 5.

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?

Usage is only implied: the reader infers this is the sender-side step of a KEM exchange and that the keyHandle is consumed later by crypto_encrypt, which is named. There is no statement of when to choose the hybrid variants or when not to use this tool, so guidance is present but incomplete.

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