projectimportexport

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package projectimportexport implements MCP tool handlers for the GitLab Project Import/Export API. It wraps the ProjectImportExportService from client-go v2 to schedule exports, check export/import status, download export archives, and import projects from file archives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatExportDownloadMarkdown

func FormatExportDownloadMarkdown(out ExportDownloadOutput) *mcp.CallToolResult

FormatExportDownloadMarkdown performs the format export download markdown operation for the projectimportexport package.

func FormatExportStatusMarkdown

func FormatExportStatusMarkdown(out ExportStatusOutput) *mcp.CallToolResult

FormatExportStatusMarkdown performs the format export status markdown operation for the projectimportexport package.

func FormatImportStatusMarkdown

func FormatImportStatusMarkdown(out ImportStatusOutput) *mcp.CallToolResult

FormatImportStatusMarkdown performs the format import status markdown operation for the projectimportexport package.

func FormatScheduleExportMarkdown

func FormatScheduleExportMarkdown(out ScheduleExportOutput) *mcp.CallToolResult

FormatScheduleExportMarkdown performs the format schedule export markdown operation for the projectimportexport package.

func RegisterMeta

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

RegisterMeta registers the gitlab_project_import_export meta-tool.

func RegisterTools

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

RegisterTools registers all project import/export tools on the MCP server.

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 `` /* 179-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"`
}

ImportFromFileInput is the input for importing a project from an archive file.

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"`
	UploadURL   string               `json:"upload_url,omitempty" jsonschema:"URL to upload the exported project to after export completes"`
	UploadHTTP  string               `json:"upload_http_method,omitempty" jsonschema:"HTTP method to use for the upload (PUT or POST)"`
}

ScheduleExportInput is the input for scheduling a project export.

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.

Jump to

Keyboard shortcuts

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