projectimportexport

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package projectimportexport implements MCP tools for GitLab project import and export operations.

The package wraps the GitLab Project import/export API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for project import and export actions.

func FormatExportDownloadMarkdown

func FormatExportDownloadMarkdown(out ExportDownloadOutput) *mcp.CallToolResult

FormatExportDownloadMarkdown coordinates format export download markdown for the projectimportexport package.

func FormatExportStatusMarkdown

func FormatExportStatusMarkdown(out ExportStatusOutput) *mcp.CallToolResult

FormatExportStatusMarkdown coordinates format export status markdown for the projectimportexport package.

func FormatImportStatusMarkdown

func FormatImportStatusMarkdown(out ImportStatusOutput) *mcp.CallToolResult

FormatImportStatusMarkdown coordinates format import status markdown for the projectimportexport package.

func FormatScheduleExportMarkdown

func FormatScheduleExportMarkdown(out ScheduleExportOutput) *mcp.CallToolResult

FormatScheduleExportMarkdown coordinates format schedule export markdown for the projectimportexport package.

Types

type ExportDownloadInput

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

ExportDownloadInput is the input for downloading a project export.

type ExportDownloadOutput

type ExportDownloadOutput struct {
	toolutil.HintableOutput
	ContentBase64 string `json:"content_base64"`
	SizeBytes     int    `json:"size_bytes"`
}

ExportDownloadOutput is the output for downloading a project export.

func ExportDownload

func ExportDownload(ctx context.Context, client *gitlabclient.Client, input ExportDownloadInput) (ExportDownloadOutput, error)

ExportDownload downloads the finished export archive of a project as base64.

type ExportStatusInput

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

ExportStatusInput is the input for getting export status.

type ExportStatusOutput

type ExportStatusOutput struct {
	toolutil.HintableOutput
	ID                int64  `json:"id"`
	Description       string `json:"description"`
	Name              string `json:"name"`
	NameWithNamespace string `json:"name_with_namespace"`
	Path              string `json:"path"`
	PathWithNamespace string `json:"path_with_namespace"`
	CreatedAt         string `json:"created_at,omitempty"`
	ExportStatus      string `json:"export_status"`
	Message           string `json:"message,omitempty"`
	APIURL            string `json:"api_url,omitempty"`
	WebURL            string `json:"web_url,omitempty"`
}

ExportStatusOutput is the output for getting export status.

func GetExportStatus

func GetExportStatus(ctx context.Context, client *gitlabclient.Client, input ExportStatusInput) (ExportStatusOutput, error)

GetExportStatus returns the export status of a project.

type GetImportStatusInput

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

GetImportStatusInput is the input for getting import status.

type ImportFromFileInput

type ImportFromFileInput struct {
	FilePath       string                     `` /* 289-byte string literal not displayed */
	ContentBase64  string                     `` /* 143-byte string literal not displayed */
	Namespace      string                     `json:"namespace,omitempty" jsonschema:"Namespace to import the project into (user or group path)"`
	Name           string                     `json:"name,omitempty" jsonschema:"Name for the imported project"`
	Path           string                     `json:"path,omitempty" jsonschema:"URL path for the imported project"`
	Overwrite      *bool                      `json:"overwrite,omitempty" jsonschema:"If true, overwrite an existing project with the same path"`
	OverrideParams *ImportOverrideParamsInput `` /* 179-byte string literal not displayed */
}

ImportFromFileInput is the input for importing a project from an archive file. Fields mirror gl.ImportFileOptions 1:1 (override_params is exposed as a curated nested struct over gl.CreateProjectOptions).

type ImportOverrideParamsInput added in v2.3.0

type ImportOverrideParamsInput struct {
	Name                         string `json:"name,omitempty" jsonschema:"Override the imported project's name"`
	Path                         string `json:"path,omitempty" jsonschema:"Override the imported project's URL path (slug)"`
	NamespaceID                  *int64 `json:"namespace_id,omitempty" jsonschema:"Override the namespace ID the imported project is created in"`
	Description                  string `json:"description,omitempty" jsonschema:"Override the imported project's description"`
	Visibility                   string `json:"visibility,omitempty" jsonschema:"Override visibility level (private, internal, public)"`
	DefaultBranch                string `json:"default_branch,omitempty" jsonschema:"Override the default branch name"`
	MergeMethod                  string `json:"merge_method,omitempty" jsonschema:"Override merge method (merge, rebase_merge, ff)"`
	RequestAccessEnabled         *bool  `json:"request_access_enabled,omitempty" jsonschema:"Override whether users can request access"`
	LFSEnabled                   *bool  `json:"lfs_enabled,omitempty" jsonschema:"Override Git LFS enablement"`
	SharedRunnersEnabled         *bool  `json:"shared_runners_enabled,omitempty" jsonschema:"Override whether shared (instance) CI runners are enabled"`
	IssuesAccessLevel            string `json:"issues_access_level,omitempty" jsonschema:"Override issues access level (disabled, private, enabled)"`
	MergeRequestsAccessLevel     string `json:"merge_requests_access_level,omitempty" jsonschema:"Override merge requests access level (disabled, private, enabled)"`
	WikiAccessLevel              string `json:"wiki_access_level,omitempty" jsonschema:"Override wiki access level (disabled, private, enabled)"`
	BuildsAccessLevel            string `json:"builds_access_level,omitempty" jsonschema:"Override CI/CD builds access level (disabled, private, enabled)"`
	SnippetsAccessLevel          string `json:"snippets_access_level,omitempty" jsonschema:"Override snippets access level (disabled, private, enabled)"`
	ContainerRegistryAccessLevel string `` /* 131-byte string literal not displayed */
}

ImportOverrideParamsInput mirrors the project-create attributes that GitLab accepts under the import-from-file `override_params` field. It maps to gl.CreateProjectOptions (the type of gl.ImportFileOptions.OverrideParams).

GitLab documents override_params as accepting the full set of create-project attributes (the entire gl.CreateProjectOptions set, ~79 fields). Exposing all of them as flat MCP input fields would bloat this tool's schema and duplicate the dedicated gitlab_project create/update tools, so this struct deliberately surfaces only the commonly-overridden subset a user realistically changes during an import (identity, visibility, default branch, merge method, access-request/LFS/shared-runner toggles, and the high-traffic feature access levels). Full project configuration remains available via the dedicated gitlab_project create/update tools. Only set fields are forwarded.

type ImportStatusOutput

type ImportStatusOutput struct {
	toolutil.HintableOutput
	ID                int64  `json:"id"`
	Description       string `json:"description"`
	Name              string `json:"name"`
	NameWithNamespace string `json:"name_with_namespace"`
	Path              string `json:"path"`
	PathWithNamespace string `json:"path_with_namespace"`
	CreatedAt         string `json:"created_at,omitempty"`
	ImportStatus      string `json:"import_status"`
	ImportType        string `json:"import_type,omitempty"`
	CorrelationID     string `json:"correlation_id,omitempty"`
	ImportError       string `json:"import_error,omitempty"`
}

ImportStatusOutput is the output for import operations.

func GetImportStatus

func GetImportStatus(ctx context.Context, client *gitlabclient.Client, input GetImportStatusInput) (ImportStatusOutput, error)

GetImportStatus returns the import status of a project.

func ImportFromFile

func ImportFromFile(ctx context.Context, client *gitlabclient.Client, input ImportFromFileInput) (ImportStatusOutput, error)

ImportFromFile imports a project from an export archive.

type ScheduleExportInput

type ScheduleExportInput struct {
	ProjectID   toolutil.StringOrInt       `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Description string                     `json:"description,omitempty" jsonschema:"Override the project description in the export"`
	Upload      *ScheduleExportUploadInput `` /* 135-byte string literal not displayed */

	// Deprecated: use Upload.URL. Retained as a flat alias for backward
	// compatibility; ignored when Upload is set.
	UploadURL string `` /* 129-byte string literal not displayed */
	// Deprecated: use Upload.HTTPMethod. Retained as a flat alias for backward
	// compatibility; ignored when Upload is set.
	UploadHTTP string `` /* 132-byte string literal not displayed */
}

ScheduleExportInput is the input for scheduling a project export. Fields mirror gl.ScheduleExportOptions 1:1.

type ScheduleExportOutput

type ScheduleExportOutput struct {
	toolutil.HintableOutput
	Message string `json:"message"`
}

ScheduleExportOutput is the output for scheduling a project export.

func ScheduleExport

func ScheduleExport(ctx context.Context, client *gitlabclient.Client, input ScheduleExportInput) (ScheduleExportOutput, error)

ScheduleExport schedules an asynchronous project export.

type ScheduleExportUploadInput added in v2.3.0

type ScheduleExportUploadInput struct {
	URL        string `json:"url,omitempty" jsonschema:"URL to upload the exported project archive to after export completes"`
	HTTPMethod string `json:"http_method,omitempty" jsonschema:"HTTP method to use for the upload (PUT or POST; default PUT)"`
}

ScheduleExportUploadInput mirrors gl.ScheduleExportUploadOptions: the nested upload destination for a scheduled export. When set, GitLab uploads the generated archive to the given URL instead of (or in addition to) keeping it for download.

Jump to

Keyboard shortcuts

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