Skip to main content
Glama

CipherHUB Cryptography Toolkit

generate_sm2

Read-only

[sm2] 生成 SM2(SM2P256V1 / 国密曲线)密钥对。 【参数】

  • private_key_password:必填,私钥 PEM 加密口令(1-64 字节;私钥只有加密 PEM 一种导出形态) 【输出】public_key_in_pem、private_key_in_pem、z_in_hex、point_x_in_hex、point_y_in_hex、public_key_in_hex、private_key_in_hex。 【后续操作】公钥用于 sm2_encryption / sm2_verify,私钥用于 sm2_decryption / sm2_sign。

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

Input Schema

NameRequiredDescriptionDefault
private_key_passwordNo私钥的加密密码(原始字符串,非编码格式),可选

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / private_key_password / description
      Added value: +"私钥的加密密码(原始字符串,非编码格式),可选"
  2. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true and openWorldHint=false, so the description earns credit for adding that the private key is only ever exported as an encrypted PEM, plus the full list of returned fields. It does not discuss key lifetime, storage, or any rate/permission considerations, keeping 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?

Bracketed section headers (【参数】/【输出】/【后续操作】) make it scannable and the purpose sentence is front-loaded. The output enumeration is long but justified because no output schema exists; nothing is truly redundant.

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 compensates by enumerating every returned field, and it covers parameters and downstream usage. The only gap is the unresolved required-vs-optional discrepancy for private_key_password, which leaves an agent unsure whether it must supply a password.

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 the description does add the 1-64 byte length bound. However it states private_key_password is 必填 (required) while the schema marks it optional with a default of "", a direct conflict that undermines trust in the parameter guidance.

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 gives a specific verb and resource (生成 SM2 密钥对) and pins the exact curve (SM2P256V1 / 国密曲线), which is what separates it from the generate_ecc, generate_rsa and generate_sm9 siblings. An agent can pick this tool without opening the schema.

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?

The 【后续操作】 section explicitly routes the agent: the public key feeds sm2_encryption / sm2_verify and the private key feeds sm2_decryption / sm2_sign, which is real when-to-use guidance. It stops short of saying when to prefer SM2 over the ECC/RSA generators, so it is clear context without explicit exclusions.

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.