create-environment
Set up new environments in Infisical by specifying project ID, name, and slug. This tool facilitates organized secret management within defined project structures.
Instructions
Create a new environment in Infisical
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the environment to create (required) | |
| position | No | The position of the environment to create | |
| projectId | Yes | The ID of the project to create the environment in (required) | |
| slug | Yes | The slug of the environment to create (required) |
Implementation Reference
- src/index.ts:619-637 (handler)The main handler logic for the 'create-environment' tool. It validates input using Zod, calls the Infisical SDK to create the environment, and returns a success response with the created environment details.if (name === AvailableTools.CreateEnvironment) { const data = createEnvironmentSchema.zod.parse(args); const environment = await infisicalSdk.environments().create({ projectId: data.projectId, name: data.name, slug: data.slug, position: data.position }); return { content: [ { type: "text", text: `Environment created successfully: ${JSON.stringify(environment, null, 3)}` } ] }; }
- src/index.ts:322-356 (schema)Defines the Zod validation schema and the tool capability metadata (name, description, inputSchema) for the 'create-environment' tool.const createEnvironmentSchema = { zod: z.object({ projectId: z.string(), name: z.string(), slug: z.string(), position: z.number().optional() }), capability: { name: AvailableTools.CreateEnvironment, description: "Create a new environment in Infisical", inputSchema: { type: "object", properties: { projectId: { type: "string", description: "The ID of the project to create the environment in (required)" }, name: { type: "string", description: "The name of the environment to create (required)" }, slug: { type: "string", description: "The slug of the environment to create (required)" }, position: { type: "number", description: "The position of the environment to create" } }, required: ["projectId", "name", "slug"] } } };
- src/index.ts:452-467 (registration)Registers all tool capabilities, including 'create-environment', in the ListToolsRequestHandler, making the tool discoverable.server.setRequestHandler(ListToolsRequestSchema, async () => { 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:64-64 (registration)Defines the string constant for the tool name in the AvailableTools enum, used in schema and handler.CreateEnvironment = "create-environment",