list_secrets
List all secret keys with quantum metadata like scope, decay status, and entanglement details while keeping values secure. Use to manage API keys anchored to your OS vault without exposing plaintext data.
Instructions
List all secret keys with quantum metadata (scope, decay status, superposition states, entanglement, access count). Values are never exposed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | Scope: global or project | |
| projectPath | No | Project root path for project-scoped secrets |
Implementation Reference
- src/core/keyring.ts:266-310 (handler)The core implementation of the listSecrets function which aggregates secrets from different keyring services.
export function listSecrets(opts: KeyringOptions = {}): SecretEntry[] { const source = opts.source ?? "cli"; const services: { service: string; scope: Scope }[] = []; if (!opts.scope || opts.scope === "global") { services.push({ service: globalService(), scope: "global" }); } if ((!opts.scope || opts.scope === "project") && opts.projectPath) { services.push({ service: projectService(opts.projectPath), scope: "project", }); } const results: SecretEntry[] = []; const seen = new Set<string>(); for (const { service, scope } of services) { try { const credentials = findCredentials(service); for (const cred of credentials) { const id = `${scope}:${cred.account}`; if (seen.has(id)) continue; seen.add(id); const envelope = parseEnvelope(cred.password) ?? wrapLegacy(cred.password); const decay = checkDecay(envelope); results.push({ key: cred.account, scope, envelope, decay, }); } } catch { // keyring unavailable } } logAudit({ action: "list", source }); return results.sort((a, b) => a.key.localeCompare(b.key)); } - src/mcp/server.ts:89-126 (registration)Registration of the "list_secrets" MCP tool, which invokes the core implementation.
server.tool( "list_secrets", "List all secret keys with quantum metadata (scope, decay status, superposition states, entanglement, access count). Values are never exposed.", { scope: scopeSchema, projectPath: projectPathSchema, }, async (params) => { const entries = listSecrets(opts(params)); if (entries.length === 0) return text("No secrets found"); const lines = entries.map((e) => { const parts = [`[${e.scope}] ${e.key}`]; if (e.envelope?.states) { parts.push(`states:[${Object.keys(e.envelope.states).join(",")}]`); } if (e.decay?.isExpired) { parts.push("EXPIRED"); } else if (e.decay?.isStale) { parts.push(`stale(${e.decay.lifetimePercent}%)`); } if (e.decay?.timeRemaining && !e.decay.isExpired) { parts.push(`ttl:${e.decay.timeRemaining}`); } if (e.envelope?.meta.entangled?.length) { parts.push(`entangled:${e.envelope.meta.entangled.length}`); } if (e.envelope && e.envelope.meta.accessCount > 0) { parts.push(`reads:${e.envelope.meta.accessCount}`); } return parts.join(" | "); }); return text(lines.join("\n")); }, );