civariables

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package civariables implements MCP tool handlers for GitLab project-level CI/CD variables. It supports list, get, create, update, and delete operations via the ProjectVariables API.

markdown.go provides Markdown formatting functions for CI/CD variable MCP tool output.

register.go wires civariables MCP tools to the MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error

Delete deletes resources for the civariables package.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a paginated list of CI/CD variables as a Markdown table.

func FormatOutputMarkdown

func FormatOutputMarkdown(v Output) string

FormatOutputMarkdown renders a single CI/CD variable as Markdown.

func RegisterTools

func RegisterTools(server *mcp.Server, client *gitlab.Client)

RegisterTools registers the five CI/CD variable management tools with the MCP server.

Types

type CreateInput

type CreateInput struct {
	ProjectID        toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Key              string               `json:"key" jsonschema:"Variable key name,required"`
	Value            string               `json:"value" jsonschema:"Variable value,required"`
	Description      string               `json:"description" jsonschema:"Variable description"`
	VariableType     string               `json:"variable_type" jsonschema:"Variable type: env_var or file"`
	Protected        *bool                `json:"protected" jsonschema:"Only expose in protected branches/tags"`
	Masked           *bool                `json:"masked" jsonschema:"Mask variable value in job logs"`
	MaskedAndHidden  *bool                `json:"masked_and_hidden" jsonschema:"Mask and hide variable value"`
	Raw              *bool                `json:"raw" jsonschema:"Treat variable value as raw string"`
	EnvironmentScope string               `json:"environment_scope" jsonschema:"Environment scope (default: *)"`
}

CreateInput holds parameters for creating a project CI/CD variable.

type DeleteInput

type DeleteInput struct {
	ProjectID        toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Key              string               `json:"key" jsonschema:"Variable key name,required"`
	EnvironmentScope string               `json:"environment_scope" jsonschema:"Filter by environment scope"`
}

DeleteInput holds parameters for deleting a project CI/CD variable.

type GetInput

type GetInput struct {
	ProjectID        toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Key              string               `json:"key" jsonschema:"Variable key name,required"`
	EnvironmentScope string               `json:"environment_scope" jsonschema:"Filter by environment scope"`
}

GetInput holds parameters for retrieving a single project CI/CD variable.

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	toolutil.PaginationInput
}

ListInput holds parameters for listing project CI/CD variables.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	Variables  []Output                  `json:"variables"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListOutput represents a paginated list of CI/CD variables.

func List

func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)

List lists resources for the civariables package.

type Output

type Output struct {
	toolutil.HintableOutput
	Key              string `json:"key"`
	Value            string `json:"value"`
	VariableType     string `json:"variable_type"`
	Protected        bool   `json:"protected"`
	Masked           bool   `json:"masked"`
	Hidden           bool   `json:"hidden"`
	Raw              bool   `json:"raw"`
	EnvironmentScope string `json:"environment_scope"`
	Description      string `json:"description"`
}

Output represents a single CI/CD variable.

func Create

func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)

Create creates resources for the civariables package.

func Get

func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)

Get retrieves resources for the civariables package.

func Update

func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)

Update updates resources for the civariables package.

type UpdateInput

type UpdateInput struct {
	ProjectID        toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Key              string               `json:"key" jsonschema:"Variable key name,required"`
	Value            string               `json:"value" jsonschema:"Updated variable value"`
	Description      string               `json:"description" jsonschema:"Updated variable description"`
	VariableType     string               `json:"variable_type" jsonschema:"Variable type: env_var or file"`
	Protected        *bool                `json:"protected" jsonschema:"Only expose in protected branches/tags"`
	Masked           *bool                `json:"masked" jsonschema:"Mask variable value in job logs"`
	Raw              *bool                `json:"raw" jsonschema:"Treat variable value as raw string"`
	EnvironmentScope string               `json:"environment_scope" jsonschema:"Filter by environment scope"`
}

UpdateInput holds parameters for updating a project CI/CD variable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL