Documentation
¶
Overview ¶
Package modelregistry implements MCP tools for GitLab model registry operations.
The package wraps the GitLab Model registry 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 Model Registry actions exposed as MCP tools. The download route is projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).
func FormatDownloadMarkdown ¶
func FormatDownloadMarkdown(o DownloadOutput) string
FormatDownloadMarkdown renders a downloaded ML model package file as the card of one object: where it came from, what it is called and how large it is, with the note that the bytes themselves travel in the structured output.
Types ¶
type DownloadInput ¶
type DownloadInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
ModelVersionID toolutil.StringOrInt `` /* 187-byte string literal not displayed */
Path string `` /* 168-byte string literal not displayed */
Filename string `json:"filename" jsonschema:"Name of the file to download,required"`
}
DownloadInput holds parameters for downloading a ML model package file.
type DownloadOutput ¶
type DownloadOutput struct {
toolutil.HintableOutput
ProjectID string `json:"project_id"`
ModelVersionID string `json:"model_version_id"`
Path string `json:"path"`
Filename string `json:"filename"`
ContentBase64 string `json:"content_base64"`
SizeBytes int `json:"size_bytes"`
}
DownloadOutput represents the downloaded ML model package file.
func Download ¶
func Download(ctx context.Context, client *gitlabclient.Client, in DownloadInput) (DownloadOutput, error)
Download retrieves a single file from a machine learning model package via the GitLab Model Registry API (GET /projects/:id/packages/ml_models/:model_version_id/files/(:path/):filename). Returns the raw bytes base64-encoded in ContentBase64, with SizeBytes describing the decoded size.
The request carries the token as "Authorization: Bearer", which is the only header the route reads (gitlabclient.Client.BearerToken); a file at the package root is requested without a path segment, which client-go cannot write ([downloadFromPackageRoot]). The model version and the file name each reach the path as one segment whose dots are not escaped, so a value with a "." or ".." segment is refused before any request, naming the parameter; the path is normalized instead ([downloadModelFile]), and a dot segment in it that the normalization does not read as one is refused the same way ([rejectUnresolvedDotSegment]).