delete-env-var
Remove a specific environment variable from a profile in the MCP Environment & Installation Manager, ensuring clean and precise configuration management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Environment variable key | |
| profileId | Yes | Profile ID to delete environment variable from |
Implementation Reference
- src/tools/environment-tools.ts:140-175 (registration)Registration of the 'delete-env-var' MCP tool, including input schema and inline handler function that validates parameters, checks profile existence, calls ConfigService.deleteEnvVar, and returns a success response.server.tool( "delete-env-var", { profileId: z.string().describe("Profile ID to delete environment variable from"), key: z.string().describe("Environment variable key") }, async ({ profileId, key }, extra) => { if (!profileId.trim()) { throw new Error("Profile ID cannot be empty"); } if (!key.trim()) { throw new Error("Environment variable key cannot be empty"); } const profile = configService.getProfile(profileId); if (!profile) { throw new Error(`Profile not found: ${profileId}`); } configService.deleteEnvVar(profileId, key); return { content: [ { type: "text", text: JSON.stringify({ success: true, profileId, key }, null, 2) } ] }; } );
- src/services/config-service.ts:233-241 (handler)Helper method in ConfigService that implements the core deletion logic: retrieves env vars for profile, validates key exists, deletes the key, and persists to storage.deleteEnvVar(profileId: string, key: string): void { const vars = this.getEnvVars(profileId); if (!vars[key]) { throw new Error(`Environment variable not found: ${key}`); } delete vars[key]; this.envStore.set(profileId, vars); }
- Zod input schema defining profileId and key parameters for the delete-env-var tool.{ profileId: z.string().describe("Profile ID to delete environment variable from"), key: z.string().describe("Environment variable key")