Skip to main content
Glama
laszlopere

mcp-bytesmith

derive_key

Derive cryptographic key bytes from a password or secret using PBKDF2, scrypt, or HKDF. Specify salt, length, and params for reproducible key derivation.

Instructions

Derive raw key bytes from a password or secret via a KDF (PBKDF2/scrypt/HKDF).

Returns the key rendered per output_format, plus the kdf, length, salt and params actually used — everything needed to repeat the derivation. Fully deterministic: the same inputs always give the same key, so an omitted salt means an empty one rather than a fresh random one. Use pbkdf2/scrypt to stretch a human password, and hkdf only to expand a secret that is already high-entropy (a shared secret, another key). To STORE a password for later checking, use password_hash instead — its output is a self-describing string built to be compared against. Example: derive_key("hunter2", kdf="pbkdf2", salt="0011223344556677", length=32) -> {"key": "a3f1...", "params": {"iterations": 600000, ...}}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kdfNoKey-derivation function. 'pbkdf2'/'scrypt' stretch a low-entropy password (slow by design); 'hkdf' (RFC 5869) expands an already-high-entropy secret and is fast — do NOT use it on a password. Default 'pbkdf2'.pbkdf2
saltNoSalt as hex. Omitted means NO salt (an empty one), which keeps the derivation reproducible — this tool never invents a random salt, since the key would be unrecoverable. For pbkdf2/scrypt pass a real salt (16 random bytes); for hkdf omitting it is the RFC default. Echoed back as `salt`.
lengthNoDerived key length in bytes (1..1024). Default 32.
paramsNoKDF parameters overriding the defaults: pbkdf2 {iterations:600000, prf:'sha256'}; scrypt {ln:14, r:8, p:1}; hkdf {hash:'sha256', info:''} where `info` is a UTF-8 context label that binds the key to a purpose. Default None.
passwordYesThe password, secret, or input keying material, read as UTF-8. Never echoed back.
output_formatNoHow the key is rendered (bare hex, no 0x); default 'hex'.hex
Behavior5/5

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

With no annotations provided, the description fully discloses behavioral traits: determinism (same inputs always yield same key), omitted salt implies empty salt (not random), password never echoed back, and performance differences between KDFs. This provides essential behavioral context for safe tool use.

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?

The description is concisely written (~150 words) with an effective structure: main purpose first, then details, then an illustrative example. Every sentence adds critical information without redundancy, making it efficient for an AI agent to parse.

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?

Given the complexity of KDFs and the lack of an output schema, the description covers all essential aspects: purpose, algorithm selection, determinism, return format (key, kdf, length, salt, params), and cross-reference to password_hash. It provides a complete mental model for correct tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema covers all 6 parameters (100% coverage), the description adds significant value beyond the schema: explains the default salt behavior, the entropy requirements for kdf, the meaning of output_format ('bare hex, no 0x'), and details the params structure with example overrides. This enhances usability beyond what the schema alone provides.

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 clearly states the verb 'derive' and resource 'raw key bytes from a password or secret via a KDF', and explicitly distinguishes from sibling tool 'password_hash' for password storage. This makes the purpose unambiguous and differentiates it from other tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use each KDF variant (pbkdf2/scrypt for passwords, hkdf only for high-entropy secrets), warns against misuse of hkdf on passwords, and directs users to the sibling tool 'password_hash' for password storage. This meets the highest standard of usage clarity.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/laszlopere/mcp-bytesmith'

If you have feedback or need assistance with the MCP directory API, please join our Discord server