update-secret
Modify secret details in Infisical, including name, value, or path, for a specific project and environment.
Instructions
Update a secret in Infisical
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environmentSlug | Yes | The slug of the environment to update the secret in (required) | |
| newSecretName | No | The new name of the secret to update (Optional) | |
| projectId | Yes | The ID of the project to update the secret in (required) | |
| secretName | Yes | The current name of the secret to update (required) | |
| secretPath | No | The path of the secret to update (Defaults to /) | |
| secretValue | No | The new value of the secret to update (Optional) |
Implementation Reference
- src/index.ts:514-531 (handler)Handler for the 'update-secret' tool: parses input, calls infisicalSdk.secrets().updateSecret, and returns the updated secret details.if (name === AvailableTools.UpdateSecret) { const data = updateSecretSchema.zod.parse(args); const { secret } = await infisicalSdk.secrets().updateSecret(data.secretName, { environment: data.environmentSlug, projectId: data.projectId, secretPath: data.secretPath, secretValue: data.secretValue ?? "" }); return { content: [ { type: "text", text: `Secret updated successfully. Updated secret: ${JSON.stringify(secret, null, 3)}` } ] };
- src/index.ts:145-188 (schema)Zod validation schema and MCP capability definition (including inputSchema) for the 'update-secret' tool.const updateSecretSchema = { zod: z.object({ projectId: z.string(), environmentSlug: z.string(), secretName: z.string(), newSecretName: z.string().optional(), secretValue: z.string().optional(), secretPath: z.string().default("/") }), capability: { name: AvailableTools.UpdateSecret, description: "Update a secret in Infisical", inputSchema: { type: "object", properties: { projectId: { type: "string", description: "The ID of the project to update the secret in (required)" }, environmentSlug: { type: "string", description: "The slug of the environment to update the secret in (required)" }, secretName: { type: "string", description: "The current name of the secret to update (required)" }, newSecretName: { type: "string", description: "The new name of the secret to update (Optional)" }, secretValue: { type: "string", description: "The new value of the secret to update (Optional)" }, secretPath: { type: "string", description: "The path of the secret to update (Defaults to /)" } }, required: ["projectId", "environmentSlug", "secretName"] } } };
- src/index.ts:453-467 (registration)Registration of 'update-secret' tool (via updateSecretSchema.capability) in the ListTools response.return { tools: [ createSecretSchema.capability, deleteSecretSchema.capability, updateSecretSchema.capability, listSecretsSchema.capability, getSecretSchema.capability, createProjectSchema.capability, createEnvironmentSchema.capability, createFolderSchema.capability, inviteMembersToProjectSchema.capability, listProjectsSchema.capability ] }; });
- src/index.ts:60-60 (helper)Constant definition for the 'update-secret' tool name in AvailableTools enum.UpdateSecret = "update-secret",