sm2_public_key_to_hex
[sm2] 将 SM2 PEM 公钥转换为裸 Hex 编码(未压缩点,04 || X || Y)。返回字段:public_key_in_hex(130 个 hex 字符,65 字节)。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| public_key_in_pem | No | SM2 公钥的 PEM 文本(含 BEGIN/END PUBLIC KEY 头尾) |
[sm2] 将 SM2 PEM 公钥转换为裸 Hex 编码(未压缩点,04 || X || Y)。返回字段:public_key_in_hex(130 个 hex 字符,65 字节)。
| Name | Required | Description | Default |
|---|---|---|---|
| public_key_in_pem | No | SM2 公钥的 PEM 文本(含 BEGIN/END PUBLIC KEY 头尾) |
Changes observed during successful MCP inspections.
Input schema / properties / public_key_in_pem / descriptionAdded value: +"SM2 公钥的 PEM 文本(含 BEGIN/END PUBLIC KEY 头尾)"Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations available, the description carries the full burden and does well by disclosing the output format (130 hex chars, 65 bytes) and the 04||X||Y structure. It does not mention error behavior or input validation, but for a stateless conversion tool this is a minor gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences deliver all core information without redundancy. The description is appropriately front-loaded and every clause adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple one-parameter conversion tool with no output schema, the description is nearly complete: it names the return field, gives the exact hex length, and specifies the encoding. It could optionally note that the input must be a valid SM2 key, but this is implied by the tool name and purpose.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already documents the single parameter with a complete description (PEM text with BEGIN/END headers). The tool description adds no further parameter-level meaning, aligning with the baseline for 100% schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool converts an SM2 PEM public key into raw hex encoding (uncompressed point 04||X||Y), specifying the exact output field and byte length. This specific verb+resource+outcome strongly distinguishes it from sibling SM2 tools like sm2_sign or sm2_verify.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit when-to-use guidance or alternatives are mentioned. The usage is implied from the description, but there is no comparison with similar tools (e.g., sm2_private_key_structure_parse) or exclusions for other key formats.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Add one secure layer between your agents and this server.