Skip to main content
Glama

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
NameRequiredDescriptionDefault
keyYesThe key of the variable
maskedNoWhether the variable is masked
project_idYesThe ID or URL-encoded path of the project
protectedNoWhether the variable is protected
valueYesThe value of the variable

Implementation Reference

  • 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);
    };
  • 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']
      }
    },
  • 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,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rifqi96/mcp-gitlab'

If you have feedback or need assistance with the MCP directory API, please join our Discord server