mergetrains

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package mergetrains implements MCP tool handlers for GitLab merge trains.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown formats a list of merge train entries.

func FormatOutputMarkdown

func FormatOutputMarkdown(out Output) string

FormatOutputMarkdown formats a single merge train entry.

func RegisterTools

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

RegisterTools registers individual merge train tools.

Types

type AddInput

type AddInput struct {
	ProjectID      toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MergeRequestID int64                `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
	AutoMerge      bool                 `json:"auto_merge,omitempty" jsonschema:"Enable auto-merge when pipeline succeeds"`
	SHA            string               `json:"sha,omitempty" jsonschema:"Head SHA of the merge request to verify"`
	Squash         bool                 `json:"squash,omitempty" jsonschema:"Squash commits when merging"`
}

AddInput defines parameters for adding a merge request to a merge train.

type GetInput

type GetInput struct {
	ProjectID      toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MergeRequestID int64                `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
}

GetInput defines parameters for getting a merge request on a merge train.

type ListBranchInput

type ListBranchInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	TargetBranch string               `json:"target_branch" jsonschema:"Target branch name,required"`
	Scope        string               `json:"scope,omitempty" jsonschema:"Filter by scope: active, complete"`
	Sort         string               `json:"sort,omitempty" jsonschema:"Sort order: asc or desc"`
	toolutil.PaginationInput
}

ListBranchInput defines parameters for listing MRs in a merge train for a specific branch.

type ListOutput

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

ListOutput wraps a list of merge train entries.

func AddMergeRequestToMergeTrain

func AddMergeRequestToMergeTrain(ctx context.Context, client *gitlabclient.Client, input AddInput) (ListOutput, error)

AddMergeRequestToMergeTrain adds a merge request to a merge train.

func ListMergeRequestInMergeTrain

func ListMergeRequestInMergeTrain(ctx context.Context, client *gitlabclient.Client, input ListBranchInput) (ListOutput, error)

ListMergeRequestInMergeTrain lists merge requests in a merge train for a branch.

func ListProjectMergeTrains

func ListProjectMergeTrains(ctx context.Context, client *gitlabclient.Client, input ListProjectInput) (ListOutput, error)

ListProjectMergeTrains lists all merge trains for a project.

type ListProjectInput

type ListProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Scope     string               `json:"scope,omitempty" jsonschema:"Filter by scope: active, complete"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort order: asc or desc"`
	toolutil.PaginationInput
}

ListProjectInput defines parameters for listing project merge trains.

type MergeRequestOutput

type MergeRequestOutput struct {
	ID        int64  `json:"id"`
	IID       int64  `json:"iid"`
	ProjectID int64  `json:"project_id"`
	Title     string `json:"title"`
	State     string `json:"state"`
	WebURL    string `json:"web_url,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

MergeRequestOutput represents the MR embedded in a merge train entry.

type Output

type Output struct {
	toolutil.HintableOutput
	ID           int64              `json:"id"`
	MergeRequest MergeRequestOutput `json:"merge_request"`
	User         string             `json:"user,omitempty"`
	PipelineID   int64              `json:"pipeline_id,omitempty"`
	TargetBranch string             `json:"target_branch"`
	Status       string             `json:"status"`
	Duration     int64              `json:"duration"`
	CreatedAt    string             `json:"created_at,omitempty"`
	UpdatedAt    string             `json:"updated_at,omitempty"`
	MergedAt     string             `json:"merged_at,omitempty"`
}

Output represents a merge train entry.

func GetMergeRequestOnMergeTrain

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

GetMergeRequestOnMergeTrain gets the merge train status for a specific MR.

Jump to

Keyboard shortcuts

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