Skip to main content
Glama

CipherHUB Cryptography Toolkit

sm2_encryption

Read-only

[sm2] SM2 公钥加密。 【参数】

  • sm2_public_key_in_pem:PEM 格式公钥

  • plain_data_in_hex:明文 Hex 【输出】cipher_in_hex_with_format 字典,同时返回四种编码格式:

  • C1C3C2_ASN1:ASN.1 DER 编码(推荐,国标 GM/T 0009)

  • C1C2C3_ASN1:ASN.1 DER 旧格式

  • C1C3C2:原始拼接格式

  • C1C2C3:原始拼接旧格式 【注意】每次加密因随机 k 不同,密文不同,这是正常行为。

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": "sm2_encryption"
  }
}

Input Schema

NameRequiredDescriptionDefault
plain_data_in_hexNo明文的十六进制字符串
sm2_public_key_in_pemNoSM2 公钥的 PEM 文本(含 BEGIN/END 头尾的 Base64 编码文本)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / plain_data_in_hex / description
      Added value: +"明文的十六进制字符串"
    • addedInput schema / properties / sm2_public_key_in_pem / description
      Added value: +"SM2 公钥的 PEM 文本(含 BEGIN/END 头尾的 Base64 编码文本)"
  2. First observed

TDQS

A3.9/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, consistent with a pure local computation, so no contradiction exists. Beyond that, the description adds genuinely useful behavior: the output is a dict containing four encoding variants with a stated recommended one (C1C3C2_ASN1, GM/T 0009), and it warns that ciphertext differs on every call due to random k — a non-determinism note an agent would otherwise misread as a bug.

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 【参数】/【输出】/【注意】 sectioning is front-loaded and scannable, with the operation stated first. The parameter section lightly duplicates the schema, but nothing is wasteful enough to obscure the key facts.

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 there is no output schema, the description correctly carries the burden of explaining the return value, and it does so thoroughly by enumerating all four ciphertext encodings with their meanings. The safety profile is covered by annotations; only edge cases like invalid-key or empty-plaintext handling are left 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 description coverage is 100% and the schema's own parameter descriptions are actually richer than the description's (the schema spells out the BEGIN/END Base64 PEM framing). The description restates both parameters without adding format or validation detail, so baseline 3 applies.

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 opens with a specific verb+resource pair — '[sm2] SM2 公钥加密' — that names both the algorithm and operation. An agent can distinguish this from sm2_decryption, rsa_encryption, and sm9_encryption purely from the algorithm label without opening a schema.

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 algorithm name and the parameter list make it obvious this is the encryption direction, but there is no explicit statement of when to choose SM2 over RSA/SM9, nor a pointer to sm2_decryption for the inverse operation. Adequate but no routing guidance.

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.