Skip to main content
Glama

generate_secret

Generate cryptographic secrets using quantum noise for secure API keys, tokens, passwords, and UUIDs. Save directly to your OS-native vault to prevent plaintext leaks.

Instructions

Generate a cryptographic secret (quantum noise). Formats: hex, base64, alphanumeric, uuid, api-key, token, password. Optionally save directly to the keyring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoOutput formatapi-key
lengthNoLength in bytes or characters
prefixNoPrefix for api-key/token format
saveAsNoIf provided, save the generated secret with this key name
scopeNoScope: global or projectglobal
projectPathNoProject root path for project-scoped secrets

Implementation Reference

  • The MCP tool definition for "generate_secret", including its input schema and handler function which calls `generateSecret` from `../core/noise.js`.
      "generate_secret",
      "Generate a cryptographic secret (quantum noise). Formats: hex, base64, alphanumeric, uuid, api-key, token, password. Optionally save directly to the keyring.",
      {
        format: z
          .enum(["hex", "base64", "alphanumeric", "uuid", "api-key", "token", "password"])
          .optional()
          .default("api-key")
          .describe("Output format"),
        length: z.number().optional().describe("Length in bytes or characters"),
        prefix: z.string().optional().describe("Prefix for api-key/token format"),
        saveAs: z.string().optional().describe("If provided, save the generated secret with this key name"),
        scope: scopeSchema.default("global"),
        projectPath: projectPathSchema,
      },
      async (params) => {
        const secret = generateSecret({
          format: params.format as NoiseFormat,
          length: params.length,
          prefix: params.prefix,
        });
    
        if (params.saveAs) {
          setSecret(params.saveAs, secret, {
            ...opts(params),
            description: `Generated ${params.format} secret`,
          });
          const entropy = estimateEntropy(secret);
          return text(
            `Generated and saved as "${params.saveAs}" (${params.format}, ~${entropy} bits entropy)`,
          );
        }
    
        return text(secret);
      },
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks critical behavioral details. It doesn't disclose whether generation is deterministic or random, what 'quantum noise' means practically, security implications, rate limits, or authentication requirements for the keyring operation.

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 description is appropriately sized with two clear sentences. The first sentence front-loads the core purpose and format options, while the second adds the optional saving feature. No wasted words, though it could be slightly more structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a cryptographic tool with 6 parameters and no annotations or output schema, the description is inadequate. It doesn't explain what 'quantum noise' means operationally, security characteristics, error conditions, or what the tool returns. The absence of output schema means the description should explain return values but doesn't.

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%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema - it mentions 'Optionally save directly to the keyring' which relates to saveAs parameter, but doesn't provide additional context about parameter interactions or constraints.

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 tool's purpose with specific verbs ('Generate a cryptographic secret') and resource ('quantum noise'), plus it distinguishes from siblings by mentioning optional keyring saving - a feature not present in other secret-related tools like get_secret or set_secret.

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?

The description implies usage through format options and optional saving, but doesn't explicitly state when to use this versus alternatives like env_generate or set_secret. No guidance on when NOT to use this tool or clear prerequisites is provided.

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/I4cTime/quantum_ring'

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