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,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Create' which implies a write/mutation operation, but doesn't mention authentication requirements, permission levels needed, whether the operation is idempotent, or what happens on duplicate keys. This leaves significant gaps for a tool that modifies system state.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states exactly what the tool does with zero wasted words. It's appropriately sized for a simple creation operation and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, error conditions, authentication requirements, or how it differs from sibling tools. The combination of being a write operation with minimal behavioral disclosure creates significant gaps for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with all 5 parameters well-documented in the schema itself. The description doesn't add any additional parameter context beyond what's already in the schema, so it meets the baseline for high schema coverage without providing extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new CI/CD variable'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'gitlab_update_cicd_variable' or explain what distinguishes creation from updating.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives like 'gitlab_update_cicd_variable' or 'gitlab_list_cicd_variables'. The description offers no context about prerequisites, such as needing project access, or when creation is appropriate versus other operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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