gitlab_create_cicd_variable
Use this tool to create a new CI/CD variable in GitLab projects. Specify project ID, key, value, and optional settings like masked or protected variables for pipeline configuration.
Instructions
Create a new CI/CD variable
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | The key of the variable | |
| masked | No | Whether the variable is masked | |
| project_id | Yes | The ID or URL-encoded path of the project | |
| protected | No | Whether the variable is protected | |
| value | Yes | The value of the variable |
Implementation Reference
- src/handlers/cicd-handlers.ts:121-136 (handler)The core handler function implementing the gitlab_create_cicd_variable tool. It validates input parameters, calls the ciCdManager to create the variable, and formats the response.export const createCiCdVariable: ToolHandler = async (params, context) => { const { project_id, key, value, protected: isProtected, masked, variable_type, environment_scope } = params.arguments || {}; if (!project_id || !key || !value) { throw new McpError(ErrorCode.InvalidParams, 'project_id, key, and value are required'); } const data = await context.ciCdManager.createCiCdVariable(project_id as string | number, { key: key as string, value: value as string, protected: isProtected as boolean | undefined, masked: masked as boolean | undefined, variable_type: variable_type as 'env_var' | 'file' | undefined, environment_scope: environment_scope as string | undefined }); return formatResponse(data); };
- src/utils/tools-data.ts:638-667 (schema)The input schema definition for the gitlab_create_cicd_variable tool, specifying parameters, types, descriptions, and required fields.{ name: 'gitlab_create_cicd_variable', description: 'Create a new CI/CD variable', inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'The ID or URL-encoded path of the project' }, key: { type: 'string', description: 'The key of the variable' }, value: { type: 'string', description: 'The value of the variable' }, protected: { type: 'boolean', description: 'Whether the variable is protected' }, masked: { type: 'boolean', description: 'Whether the variable is masked' } }, required: ['project_id', 'key', 'value'] } },
- src/utils/tool-registry.ts:50-61 (registration)The tool registry mapping for gitlab_create_cicd_variable to cicdHandlers.createCiCdVariable, within the CI/CD tools section. (Note: import * as cicdHandlers from "../handlers/cicd-handlers.js"; at line 14)gitlab_list_trigger_tokens: cicdHandlers.listTriggerTokens, gitlab_get_trigger_token: cicdHandlers.getTriggerToken, gitlab_create_trigger_token: cicdHandlers.createTriggerToken, gitlab_update_trigger_token: cicdHandlers.updateTriggerToken, gitlab_delete_trigger_token: cicdHandlers.deleteTriggerToken, gitlab_trigger_pipeline: cicdHandlers.triggerPipeline, gitlab_list_cicd_variables: cicdHandlers.listCiCdVariables, gitlab_get_cicd_variable: cicdHandlers.getCiCdVariable, gitlab_create_cicd_variable: cicdHandlers.createCiCdVariable, gitlab_update_cicd_variable: cicdHandlers.updateCiCdVariable, gitlab_delete_cicd_variable: cicdHandlers.deleteCiCdVariable,