Skip to main content
Glama

generate_secret

Destructive

Generate a cryptographically random secret and optionally store it in the keyring. Use it to create new credentials you control, such as signing keys, tokens, or passwords.

Instructions

[secrets] Generate a cryptographically random secret using Node's CSPRNG and optionally store it in the keyring in one step. Use to create new credentials that you control (signing keys, internal tokens, passwords); for issuer-issued credentials (Stripe/OpenAI etc.) use rotate_secret to ask the upstream provider for a fresh key, and use set_secret for values you already have in hand. If saveAs is provided this mutates the keyring (one 'write' event) and returns a summary like 'Generated and saved as "KEY" (FORMAT, ~N bits entropy)'. Without saveAs the call is read-only and returns JSON { ok, data: { value } } containing the freshly generated string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orgIdNoOrganization identifier for org-scoped secrets. Required only when scope='org'. Example: 'acme-corp'.
scopeNoWhere the secret lives. 'global' = user keyring (default if omitted on reads), 'project' = scoped to projectPath, 'team' = team-shared (needs teamId), 'org' = org-shared (needs orgId).global
formatNoOutput shape. 'hex' / 'base64' / 'alphanumeric' = raw random string of `length` characters; 'uuid' = RFC4122 v4; 'api-key' / 'token' = random alphanumeric with optional `prefix`; 'password' = mixed-case alphanumeric with symbols. Defaults to 'api-key'.api-key
lengthNoNumber of characters (or bytes for hex/base64) to generate. Ignored for 'uuid'. Defaults to a sensible per-format value (e.g. 32 for api-key).
prefixNoLiteral prefix prepended to the random portion. Only meaningful for 'api-key' and 'token'. Example: 'sk-' or 'svc_'.
saveAsNoIf provided, store the generated value at this key name in the keyring (one mutation). Omit to just return the value without persisting.
teamIdNoTeam identifier for team-scoped secrets. Required only when scope='team'. Example: 'acme-platform'.
projectPathNoAbsolute path to the project root for project-scoped secrets and policy resolution. Defaults to the MCP server's current working directory when omitted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changedv0.11.7
    • changedInput schema / properties / format / description
      Previous value: -"Output format"New value: +"Output shape. 'hex' / 'base64' / 'alphanumeric' = raw random string of `length` characters; 'uuid' = RFC4122 v4; 'api-key' / 'token' = random alphanumeric with optional `prefix`; 'password' = mixed-case alphanumeric with symbols. Defaults to 'api-key'."
    • changedInput schema / properties / length / description
      Previous value: -"Length in bytes or characters"New value: +"Number of characters (or bytes for hex/base64) to generate. Ignored for 'uuid'. Defaults to a sensible per-format value (e.g. 32 for api-key)."
    • changedInput schema / properties / orgId / description
      Previous value: -"Org identifier for org-scoped secrets"New value: +"Organization identifier for org-scoped secrets. Required only when scope='org'. Example: 'acme-corp'."
    • changedInput schema / properties / prefix / description
      Previous value: -"Prefix for api-key/token format"New value: +"Literal prefix prepended to the random portion. Only meaningful for 'api-key' and 'token'. Example: 'sk-' or 'svc_'."
    • changedInput schema / properties / projectPath / description
      Previous value: -"Project root path for project-scoped secrets"New value: +"Absolute path to the project root for project-scoped secrets and policy resolution. Defaults to the MCP server's current working directory when omitted."
    • changedInput schema / properties / saveAs / description
      Previous value: -"If provided, save the generated secret with this key name"New value: +"If provided, store the generated value at this key name in the keyring (one mutation). Omit to just return the value without persisting."
    • changedInput schema / properties / scope / description
      Previous value: -"Scope: global, project, team, or org"New value: +"Where the secret lives. 'global' = user keyring (default if omitted on reads), 'project' = scoped to projectPath, 'team' = team-shared (needs teamId), 'org' = org-shared (needs orgId)."
    • changedInput schema / properties / teamId / description
      Previous value: -"Team identifier for team-scoped secrets"New value: +"Team identifier for team-scoped secrets. Required only when scope='team'. Example: 'acme-platform'."
  2. Changed4 schema fields changedv0.11.5
    • addedInput schema / properties / orgId
      Added value: +{
      +  "description": "Org identifier for org-scoped secrets",
      +  "type": "string"
      +}
    • changedInput schema / properties / scope / description
      Previous value: -"Scope: global or project"New value: +"Scope: global, project, team, or org"
    • changedInput schema / properties / scope / enum
      Previous value: -[
      -  "global",
      -  "project"
      -]New value: +[
      +  "global",
      +  "project",
      +  "team",
      +  "org"
      +]
    • addedInput schema / properties / teamId
      Added value: +{
      +  "description": "Team identifier for team-scoped secrets",
      +  "type": "string"
      +}
  3. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false and destructiveHint=true; the description adds value beyond them by clarifying that the call is read-only without `saveAs`, mutates with one 'write' event when `saveAs` is set, and describing both return shapes. It does not state whether `saveAs` overwrites an existing keyring entry, which is a relevant destructive-behavior gap.

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?

Front-loaded with purpose, then usage guidance, then behavioral detail. It is fairly long but every sentence carries information; minor redundancy between the intro's 'optionally store' and the later `saveAs` explanation.

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?

Despite no output schema, the description documents both return modes (a summary string with `saveAs`, JSON `{ ok, data: { value } }` without). With zero required parameters, 100% schema coverage, and clear mutation semantics, an agent has everything needed to call it correctly.

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 fully documents all 8 parameters including formats, scopes, and defaults. The description reinforces `saveAs` semantics but adds little syntax or meaning beyond what the schema provides; baseline 3 applies.

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?

States a specific verb (generate) and resource (cryptographically random secret), names the mechanism (Node's CSPRNG), and clarifies the optional store step. It also actively distinguishes itself from `rotate_secret` and `set_secret`, so an agent can pick correctly without opening sibling schemas.

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?

Explicitly states when to use this tool ('credentials that you control'), when to prefer `rotate_secret` (issuer-issued credentials), and when to prefer `set_secret` (values already in hand). Alternatives and their selecting conditions are named outright.

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