Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

get_pipeline_variables

Retrieve pipeline variables from GitLab projects to access configuration data and environment settings for CI/CD workflows.

Instructions

Get variables of a pipeline

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
pipeline_idYesPipeline ID

Implementation Reference

  • The handler function that implements the core logic of the 'get_pipeline_variables' tool by calling the GitLab API to retrieve pipeline variables and formatting the response as MCP content.
    async getPipelineVariables(args: GetPipelineVariablesParams) {
      const data = await this.client.get(`/projects/${encodeURIComponent(args.project_id)}/pipelines/${args.pipeline_id}/variables`);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • MCP tool registration defining the name, description, and input schema for 'get_pipeline_variables'.
    {
      name: 'get_pipeline_variables',
      description: 'Get variables of a pipeline',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          pipeline_id: {
            type: 'number',
            description: 'Pipeline ID',
          },
        },
        required: ['project_id', 'pipeline_id'],
      },
    },
  • TypeScript interface defining the input parameters: project_id (string) and pipeline_id (number).
    export interface GetPipelineVariablesParams {
      project_id: string;
      pipeline_id: number;
    }
  • src/server.ts:311-314 (registration)
    Server dispatch case that routes the tool call to the pipelineHandlers.getPipelineVariables method.
    case "get_pipeline_variables":
      return await this.pipelineHandlers.getPipelineVariables(
        args as unknown as GetPipelineVariablesParams
      );

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/Alosies/gitlab-mcp-server'

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