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);
      },
    );

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