Documentation
¶
Overview ¶
Package gitlab registers MCP tools for GitLab issues, merge requests, releases and repository browsing.
It talks to the GitLab API directly rather than shelling out to the glab CLI, which is what lets every tool take a project argument: glab's own MCP server derives the project from the git remote of its working directory and so cannot run outside a checkout.
Index ¶
- Constants
- func ClientToken(r *http.Request) string
- func GlabConfigDir() string
- func NewSessionServer(opts SessionServerOptions) func(*http.Request) *mcp.Server
- func Register(s *mcp.Server, c *Client)
- type ApprovalSummary
- type AuthMode
- type Client
- type ClientSet
- type Config
- type CreateIssueArgs
- type CreateIssueNoteArgs
- type CreateMergeRequestArgs
- type CreateMergeRequestNoteArgs
- type CreateReleaseArgs
- type DownloadReleaseAssetArgs
- type DownloadReleaseAssetRes
- type FileArgs
- type FileDiff
- type FileRes
- type GlabConfig
- type GlabHost
- type IssueDetail
- type IssueRes
- type IssueSummary
- type ListArgs
- type ListIssuesArgs
- type ListIssuesRes
- type ListMergeRequestsArgs
- type ListMergeRequestsRes
- type ListReleasesArgs
- type ListReleasesRes
- type MergeRequestDetail
- type MergeRequestDiffArgs
- type MergeRequestDiffRes
- type MergeRequestRes
- type MergeRequestSummary
- type NoteRes
- type NoteSummary
- type PipelineSummary
- type ProjectDetail
- type ProjectSummary
- type ReleaseAsset
- type ReleaseAssetLink
- type ReleaseDetail
- type ReleaseRes
- type ReleaseSummary
- type SearchProjectsArgs
- type SearchProjectsRes
- type SessionServerOptions
- type TreeArgs
- type TreeEntry
- type TreeRes
- type UpdateIssueArgs
- type UpdateMergeRequestArgs
- type UploadReleaseAssetArgs
- type UploadReleaseAssetRes
- type UserSummary
- type ViewIssueArgs
- type ViewIssueRes
- type ViewMergeRequestArgs
- type ViewMergeRequestRes
- type ViewProjectArgs
- type ViewProjectRes
- type ViewReleaseArgs
- type ViewReleaseRes
Constants ¶
const DefaultBaseURL = "https://gitlab.com"
DefaultBaseURL is the GitLab SaaS instance, used when Config.BaseURL is unset.
const Instructions = `` /* 640-byte string literal not displayed */
Instructions is the server-level guidance sent to clients.
Variables ¶
This section is empty.
Functions ¶
func ClientToken ¶ added in v0.7.0
ClientToken reads the caller's GitLab credential from an MCP HTTP request.
Both spellings are accepted: Authorization is what an MCP client with any notion of auth already sends, PRIVATE-TOKEN is what GitLab itself uses. A nil request means stdio, which has no headers and so no caller token.
func GlabConfigDir ¶
func GlabConfigDir() string
GlabConfigDir mirrors glab's own resolution order: GLAB_CONFIG_DIR wins outright, then XDG_CONFIG_HOME/glab-cli, then ~/.config/glab-cli.
func NewSessionServer ¶ added in v0.7.0
func NewSessionServer(opts SessionServerOptions) func(*http.Request) *mcp.Server
NewSessionServer returns the getServer function for [cmdutil.RunOptions.Handler]. It runs once per MCP session, so a session's credential is fixed for its lifetime rather than re-read per tool call. That makes the session ID as sensitive as the token: a later request on the same session runs as whoever opened it, whatever header it carries.
A nil return makes the SDK refuse the session with 400.
Types ¶
type ApprovalSummary ¶
type ApprovalSummary struct {
Approved bool `json:"approved"`
ApprovalsLeft int64 `json:"approvals_left"`
ApprovedBy []UserSummary `json:"approved_by,omitempty"`
}
ApprovalSummary is who has approved and how many more are needed.
type AuthMode ¶ added in v0.7.0
type AuthMode int
AuthMode decides where the GitLab credential for a session comes from.
Only the credential varies. The instance URL is always the operator's: a server that let a caller supply both the host and the token would be a shared server, but one that let a caller supply the host while the server supplies the token would be a credential-exfiltration endpoint.
const ( // AuthServer authenticates every session as [Config.Token]. It is the // default, and on an HTTP transport it makes the server a // shared-credential proxy: whoever reaches the port acts as that token. AuthServer AuthMode = iota // AuthClientOptional prefers the caller's token and falls back to // [Config.Token] when there is none. AuthClientOptional // AuthClientRequired refuses a session that presents no token. The // server holds no credential of its own. AuthClientRequired )
func ParseAuthMode ¶ added in v0.7.0
ParseAuthMode maps the -auth flag value onto an AuthMode.
func (AuthMode) String ¶ added in v0.7.0
String implements fmt.Stringer.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the GitLab API client with the configuration the tools need.
type ClientSet ¶ added in v0.7.0
type ClientSet struct {
// contains filtered or unexported fields
}
ClientSet hands out a Client per credential, sharing everything in Config that is not the credential — including the HTTP client, so distinct tokens share one connection pool and one egress allowlist.
func NewClientSet ¶ added in v0.7.0
NewClientSet validates cfg once and returns a set that builds clients from it on demand. cfg.Token is used for the server's own credential, if it has one; see AuthMode.
type Config ¶
type Config struct {
// BaseURL is the GitLab instance, e.g. https://gitlab.example.com. Empty
// means [DefaultBaseURL].
BaseURL string
// Token authenticates every request. Empty means unauthenticated, which
// can still read public projects.
Token string
// DefaultProject is used by tools whose project argument is empty. It is
// what makes a server pinned to one project convenient without making
// every other project unreachable; unlike glab, an explicit project always
// wins and none is required.
DefaultProject string
Timeout time.Duration
// FS is the only host filesystem the release asset tools can reach. A nil
// FS denies them, which is the right default for a server that has no
// business touching local files.
FS effect.FS
// HTTPClient performs every GitLab request. If nil, it is an
// [effect.NewHTTPClient] whose egress allowlist is exactly the configured
// instance, so neither the API client nor an asset download can reach
// another host.
//
// It is a seam for tests, and how [ClientSet] shares one connection pool
// across per-token clients. A credential never lives here — it is a
// request header — so sharing one across tokens is safe.
HTTPClient *http.Client
}
Config configures the GitLab API client.
type CreateIssueArgs ¶
type CreateIssueArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
Title string `json:"title" jsonschema:"issue title"`
Description string `json:"description,omitempty" jsonschema:"issue body, in GitLab-flavored Markdown"`
Labels []string `json:"labels,omitempty" jsonschema:"label names to apply"`
Assignees []string `json:"assignees,omitempty" jsonschema:"usernames to assign"`
Milestone string `json:"milestone,omitempty" jsonschema:"milestone title to attach"`
Confidential bool `json:"confidential,omitempty" jsonschema:"make the issue visible only to project members"`
}
type CreateIssueNoteArgs ¶
type CreateIssueNoteArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
IID int64 `json:"iid" jsonschema:"project-scoped issue number, the one shown as #123"`
Body string `json:"body" jsonschema:"comment text, in GitLab-flavored Markdown"`
}
type CreateMergeRequestArgs ¶
type CreateMergeRequestArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
SourceBranch string `json:"source_branch" jsonschema:"branch holding the changes"`
TargetBranch string `json:"target_branch,omitempty" jsonschema:"branch to merge into; defaults to the project's default branch"`
Title string `json:"title" jsonschema:"merge request title; prefix with Draft: to open it as a draft"`
Description string `json:"description,omitempty" jsonschema:"merge request body, in GitLab-flavored Markdown"`
Labels []string `json:"labels,omitempty" jsonschema:"label names to apply"`
Assignees []string `json:"assignees,omitempty" jsonschema:"usernames to assign"`
Reviewers []string `json:"reviewers,omitempty" jsonschema:"usernames to request review from"`
Milestone string `json:"milestone,omitempty" jsonschema:"milestone title to attach"`
RemoveSource bool `json:"remove_source_branch,omitempty" jsonschema:"delete the source branch once merged"`
Squash bool `json:"squash,omitempty" jsonschema:"squash commits when merging"`
}
type CreateMergeRequestNoteArgs ¶
type CreateMergeRequestNoteArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
IID int64 `json:"iid" jsonschema:"project-scoped merge request number, the one shown as !123"`
Body string `json:"body" jsonschema:"comment text, in GitLab-flavored Markdown"`
}
type CreateReleaseArgs ¶
type CreateReleaseArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
TagName string `json:"tag_name" jsonschema:"tag to release; it is created from ref when it does not exist"`
Ref string `` /* 130-byte string literal not displayed */
Name string `json:"name,omitempty" jsonschema:"release title; defaults to the tag name"`
Description string `json:"description,omitempty" jsonschema:"release notes, in GitLab-flavored Markdown"`
Milestones []string `json:"milestones,omitempty" jsonschema:"milestone titles to associate"`
ReleasedAt string `json:"released_at,omitempty" jsonschema:"RFC 3339 timestamp; a future value creates an upcoming release"`
}
type DownloadReleaseAssetArgs ¶
type DownloadReleaseAssetArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
TagName string `json:"tag_name" jsonschema:"tag of the release holding the asset"`
Name string `json:"name" jsonschema:"asset name as listed by release_view"`
Path string `json:"path" jsonschema:"local destination, relative to the server's assets directory"`
}
type DownloadReleaseAssetRes ¶
type FileArgs ¶
type FileArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
Path string `json:"path" jsonschema:"file path within the repository, e.g. cmd/main.go"`
Ref string `json:"ref,omitempty" jsonschema:"branch, tag or commit SHA; defaults to the project's default branch"`
}
type FileDiff ¶
type FileDiff struct {
OldPath string `json:"old_path"`
NewPath string `json:"new_path"`
NewFile bool `json:"new_file,omitempty"`
RenamedFile bool `json:"renamed_file,omitempty"`
DeletedFile bool `json:"deleted_file,omitempty"`
Generated bool `json:"generated_file,omitempty" jsonschema:"GitLab considers this file generated, e.g. by a linguist-generated gitattribute"`
// Diff is unified diff text. It is empty when the file was omitted: either
// GitLab itself declined to send it (TooLarge) or the response hit the
// tool's own budget.
Diff string `json:"diff,omitempty"`
TooLarge bool `json:"too_large,omitempty" jsonschema:"GitLab did not return this file's diff because it exceeds the instance limit"`
Omitted bool `` /* 133-byte string literal not displayed */
}
FileDiff is one file's change within a merge request.
type FileRes ¶
type FileRes struct {
Path string `json:"path"`
Ref string `json:"ref,omitempty"`
Content string `json:"content,omitempty"`
Size int64 `json:"size" jsonschema:"size of the file in bytes, before any truncation"`
Truncated bool `json:"truncated,omitempty"`
// Binary reports that the file is not valid UTF-8, so Content is empty
// rather than a wall of escaped bytes.
Binary bool `json:"binary,omitempty"`
}
type GlabConfig ¶
type GlabConfig struct {
// Host is the default instance hostname.
Host string `yaml:"host"`
// Hosts maps a hostname to its credentials.
Hosts map[string]GlabHost `yaml:"hosts"`
}
GlabConfig is the subset of the glab CLI's config.yml that this server reads: enough to reuse a token the operator already has, so `glab auth login` is the only setup step.
Reading it is an operator-controlled startup path — no agent influences it — which is why it uses os.ReadFile rather than an effect.FS.
func LoadGlabConfig ¶
func LoadGlabConfig(dir string) (*GlabConfig, error)
LoadGlabConfig reads glab's config.yml. A missing file is not an error: it yields a zero config, and the caller falls back to its own flags.
func (*GlabConfig) Resolve ¶
func (c *GlabConfig) Resolve(host string) (baseURL, token string)
Resolve returns the base URL and token for host, or for the config's default host when host is empty. It returns empty strings when the config has nothing to say, leaving the caller's own defaults in place.
type GlabHost ¶
type GlabHost struct {
Token string `yaml:"token"`
APIHost string `yaml:"api_host"`
APIProtocol string `yaml:"api_protocol"`
}
GlabHost holds one instance's entry in GlabConfig.
type IssueDetail ¶
type IssueDetail struct {
IssueSummary
Description string `json:"description,omitempty"`
// DescriptionTruncated reports that Description was cut at
// [descriptionLimit] runes.
DescriptionTruncated bool `json:"description_truncated,omitempty"`
Confidential bool `json:"confidential,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
Notes []NoteSummary `json:"notes,omitempty"`
}
IssueDetail adds the fields only worth fetching for a single issue.
type IssueRes ¶
type IssueRes struct {
Issue IssueSummary `json:"issue"`
}
type IssueSummary ¶
type IssueSummary struct {
IID int64 `json:"iid" jsonschema:"project-scoped issue number, the one shown as #123"`
Title string `json:"title"`
State string `json:"state"`
Author *UserSummary `json:"author,omitempty"`
Assignees []UserSummary `json:"assignees,omitempty"`
Labels []string `json:"labels,omitempty"`
Milestone string `json:"milestone,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
WebURL string `json:"web_url,omitempty"`
}
IssueSummary is the compact list view of an issue.
type ListArgs ¶
type ListArgs struct {
Page int `json:"page,omitempty" jsonschema:"1-based page number; defaults to 1"`
PerPage int `json:"per_page,omitempty" jsonschema:"results per page, 1-100; defaults to 20"`
}
ListArgs is the pagination every list tool accepts.
type ListIssuesArgs ¶
type ListIssuesArgs struct {
ListArgs
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
State string `json:"state,omitempty" jsonschema:"opened, closed, or all; defaults to opened"`
Labels string `json:"labels,omitempty" jsonschema:"comma-separated label names the issue must have all of"`
// Assignee and Author take usernames because that is what an agent reading
// an issue thread has; the API's *_id variants would need a lookup first.
Assignee string `json:"assignee,omitempty" jsonschema:"filter by assignee username"`
Author string `json:"author,omitempty" jsonschema:"filter by author username"`
Milestone string `json:"milestone,omitempty" jsonschema:"filter by milestone title"`
Search string `json:"search,omitempty" jsonschema:"free-text search over title and description"`
OrderBy string `json:"order_by,omitempty" jsonschema:"created_at, updated_at, or priority; defaults to created_at"`
Sort string `json:"sort,omitempty" jsonschema:"asc or desc; defaults to desc"`
}
type ListIssuesRes ¶
type ListIssuesRes struct {
Issues []IssueSummary `json:"issues"`
}
type ListMergeRequestsArgs ¶
type ListMergeRequestsArgs struct {
ListArgs
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
State string `json:"state,omitempty" jsonschema:"opened, closed, merged, locked, or all; defaults to opened"`
Labels string `json:"labels,omitempty" jsonschema:"comma-separated label names the merge request must have all of"`
Author string `json:"author,omitempty" jsonschema:"filter by author username"`
Assignee string `json:"assignee,omitempty" jsonschema:"filter by assignee username"`
Reviewer string `json:"reviewer,omitempty" jsonschema:"filter by reviewer username"`
SourceBranch string `json:"source_branch,omitempty"`
TargetBranch string `json:"target_branch,omitempty"`
Milestone string `json:"milestone,omitempty" jsonschema:"filter by milestone title"`
Search string `json:"search,omitempty" jsonschema:"free-text search over title and description"`
OrderBy string `json:"order_by,omitempty" jsonschema:"created_at or updated_at; defaults to created_at"`
Sort string `json:"sort,omitempty" jsonschema:"asc or desc; defaults to desc"`
}
type ListMergeRequestsRes ¶
type ListMergeRequestsRes struct {
MergeRequests []MergeRequestSummary `json:"merge_requests"`
}
type ListReleasesArgs ¶
type ListReleasesRes ¶
type ListReleasesRes struct {
Releases []ReleaseSummary `json:"releases"`
}
type MergeRequestDetail ¶
type MergeRequestDetail struct {
MergeRequestSummary
Description string `json:"description,omitempty"`
DescriptionTruncated bool `json:"description_truncated,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
MergedAt *time.Time `json:"merged_at,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
SHA string `json:"sha,omitempty" jsonschema:"head commit of the source branch"`
// DetailedMergeStatus is GitLab's own summary of whether the merge request
// can merge, e.g. mergeable, ci_still_running, not_approved.
DetailedMergeStatus string `json:"detailed_merge_status,omitempty"`
HasConflicts bool `json:"has_conflicts,omitempty"`
ChangesCount string `json:"changes_count,omitempty"`
Pipeline *PipelineSummary `json:"pipeline,omitempty"`
Approvals *ApprovalSummary `json:"approvals,omitempty"`
Notes []NoteSummary `json:"notes,omitempty"`
}
MergeRequestDetail adds the fields only worth fetching for a single merge request.
type MergeRequestDiffArgs ¶
type MergeRequestDiffArgs struct {
ListArgs
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
IID int64 `json:"iid" jsonschema:"project-scoped merge request number, the one shown as !123"`
// Paths narrows a wide merge request to the files under review, which is
// what makes a 200-file change readable at all.
Paths []string `json:"paths,omitempty" jsonschema:"only return diffs whose new or old path is exactly one of these"`
}
type MergeRequestDiffRes ¶
type MergeRequestRes ¶
type MergeRequestRes struct {
MergeRequest MergeRequestSummary `json:"merge_request"`
}
type MergeRequestSummary ¶
type MergeRequestSummary struct {
IID int64 `json:"iid" jsonschema:"project-scoped merge request number, the one shown as !123"`
Title string `json:"title"`
State string `json:"state" jsonschema:"opened, closed, merged, or locked"`
Draft bool `json:"draft,omitempty"`
SourceBranch string `json:"source_branch"`
TargetBranch string `json:"target_branch"`
Author *UserSummary `json:"author,omitempty"`
Assignees []UserSummary `json:"assignees,omitempty"`
Reviewers []UserSummary `json:"reviewers,omitempty"`
Labels []string `json:"labels,omitempty"`
Milestone string `json:"milestone,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
WebURL string `json:"web_url,omitempty"`
}
MergeRequestSummary is the compact list view of a merge request.
type NoteRes ¶
type NoteRes struct {
Note NoteSummary `json:"note"`
}
type NoteSummary ¶
type NoteSummary struct {
ID int64 `json:"id"`
Author *UserSummary `json:"author,omitempty"`
Body string `json:"body"`
System bool `json:"system,omitempty" jsonschema:"true for GitLab-generated activity notes rather than human comments"`
CreatedAt *time.Time `json:"created_at,omitempty"`
}
NoteSummary is a comment on an issue or merge request.
type PipelineSummary ¶
type PipelineSummary struct {
ID int64 `json:"id"`
Status string `json:"status"`
Ref string `json:"ref,omitempty"`
WebURL string `json:"web_url,omitempty"`
}
PipelineSummary is the head pipeline's outcome, the part of a merge request an agent asks about most.
type ProjectDetail ¶
type ProjectDetail struct {
ProjectSummary
OpenIssuesCount int64 `json:"open_issues_count,omitempty"`
Readme string `json:"readme,omitempty"`
ReadmeTruncated bool `json:"readme_truncated,omitempty"`
}
ProjectDetail adds the counts and README that are only worth a call when looking at one project.
type ProjectSummary ¶
type ProjectSummary struct {
ID int64 `json:"id"`
PathWithNS string `json:"path_with_namespace" jsonschema:"the group/project path other tools take as their project argument"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
Visibility string `json:"visibility,omitempty" jsonschema:"private, internal, or public"`
Archived bool `json:"archived,omitempty"`
Topics []string `json:"topics,omitempty"`
StarCount int64 `json:"star_count,omitempty"`
ForksCount int64 `json:"forks_count,omitempty"`
LastActivity *time.Time `json:"last_activity_at,omitempty"`
WebURL string `json:"web_url,omitempty"`
}
ProjectSummary is the compact view of a project.
type ReleaseAsset ¶
type ReleaseAsset struct {
ID int64 `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
// DirectAssetURL is the permalink form; release_asset_download prefers it.
DirectAssetURL string `json:"direct_asset_url,omitempty"`
// External marks an asset hosted outside this GitLab instance. Downloading
// one is refused: the HTTP client's allowlist is the instance itself.
External bool `json:"external,omitempty"`
LinkType string `json:"link_type,omitempty" jsonschema:"other, runbook, image, or package"`
}
ReleaseAsset is one attached link or file.
type ReleaseAssetLink ¶
ReleaseAssetLink is a source archive entry.
type ReleaseDetail ¶
type ReleaseDetail struct {
ReleaseSummary
Description string `json:"description,omitempty" jsonschema:"the release notes"`
DescriptionTruncated bool `json:"description_truncated,omitempty"`
Milestones []string `json:"milestones,omitempty"`
Assets []ReleaseAsset `json:"assets,omitempty"`
Sources []ReleaseAssetLink `json:"sources,omitempty" jsonschema:"auto-generated source archives"`
}
ReleaseDetail adds the notes and asset list.
type ReleaseRes ¶
type ReleaseRes struct {
Release ReleaseSummary `json:"release"`
}
type ReleaseSummary ¶
type ReleaseSummary struct {
TagName string `json:"tag_name"`
Name string `json:"name,omitempty"`
Author *UserSummary `json:"author,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
ReleasedAt *time.Time `json:"released_at,omitempty"`
Upcoming bool `json:"upcoming_release,omitempty" jsonschema:"released_at is in the future, so the release is not yet published"`
CommitSHA string `json:"commit_sha,omitempty"`
AssetsCount int64 `json:"assets_count"`
}
ReleaseSummary is the compact list view of a release.
type SearchProjectsArgs ¶
type SearchProjectsArgs struct {
ListArgs
Search string `json:"search" jsonschema:"text to match against project names and paths"`
Membership bool `json:"membership,omitempty" jsonschema:"only projects the authenticated user is a member of"`
OrderBy string `json:"order_by,omitempty" jsonschema:"id, name, path, created_at, updated_at, or last_activity_at; defaults to created_at"`
Sort string `json:"sort,omitempty" jsonschema:"asc or desc; defaults to desc"`
}
type SearchProjectsRes ¶
type SearchProjectsRes struct {
Projects []ProjectSummary `json:"projects"`
}
type SessionServerOptions ¶ added in v0.7.0
type SessionServerOptions struct {
// Clients builds the per-credential GitLab clients.
Clients *ClientSet
// Mode decides whose credential a session uses.
Mode AuthMode
// Server is the base MCP server configuration; one server is built per
// session from it.
Server mcputil.ServerConfig
// Logger records rejected sessions. Defaults to [slog.Default].
Logger *slog.Logger
}
SessionServerOptions configures NewSessionServer.
type TreeArgs ¶
type TreeArgs struct {
ListArgs
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
Path string `json:"path,omitempty" jsonschema:"directory to list; empty means the repository root"`
Ref string `json:"ref,omitempty" jsonschema:"branch, tag or commit SHA; defaults to the project's default branch"`
Recursive bool `json:"recursive,omitempty" jsonschema:"list the whole subtree rather than one level"`
}
type TreeEntry ¶
type TreeEntry struct {
Name string `json:"name"`
Path string `json:"path"`
Type string `json:"type" jsonschema:"tree for a directory, blob for a file"`
}
TreeEntry is one node of a repository tree.
type UpdateIssueArgs ¶
type UpdateIssueArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
IID int64 `json:"iid" jsonschema:"project-scoped issue number, the one shown as #123"`
Title string `json:"title,omitempty" jsonschema:"replace the title"`
Description string `json:"description,omitempty" jsonschema:"replace the body; this overwrites, it does not append"`
// Labels replaces the set, while AddLabels and RemoveLabels edit it. The
// distinction matters: an agent that means to add one label and sends
// Labels drops every other label on the issue.
Labels []string `json:"labels,omitempty" jsonschema:"replace all labels with this set"`
AddLabels []string `json:"add_labels,omitempty" jsonschema:"add these labels, leaving existing ones"`
RemoveLabels []string `json:"remove_labels,omitempty" jsonschema:"remove these labels, leaving the rest"`
Assignees []string `json:"assignees,omitempty" jsonschema:"replace assignees with these usernames; an empty list is ignored, use unassign"`
Unassign bool `json:"unassign,omitempty" jsonschema:"remove all assignees"`
Milestone string `json:"milestone,omitempty" jsonschema:"milestone title to attach"`
State string `json:"state,omitempty" jsonschema:"close or reopen"`
}
type UpdateMergeRequestArgs ¶
type UpdateMergeRequestArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
IID int64 `json:"iid" jsonschema:"project-scoped merge request number, the one shown as !123"`
Title string `json:"title,omitempty" jsonschema:"replace the title"`
Description string `json:"description,omitempty" jsonschema:"replace the body; this overwrites, it does not append"`
// As with issues, Labels replaces while AddLabels and RemoveLabels edit.
Labels []string `json:"labels,omitempty" jsonschema:"replace all labels with this set"`
AddLabels []string `json:"add_labels,omitempty" jsonschema:"add these labels, leaving existing ones"`
RemoveLabels []string `json:"remove_labels,omitempty" jsonschema:"remove these labels, leaving the rest"`
Assignees []string `json:"assignees,omitempty" jsonschema:"replace assignees with these usernames; an empty list is ignored, use unassign"`
Unassign bool `json:"unassign,omitempty" jsonschema:"remove all assignees"`
Reviewers []string `json:"reviewers,omitempty" jsonschema:"replace reviewers with these usernames"`
TargetBranch string `json:"target_branch,omitempty" jsonschema:"retarget the merge request at another branch"`
Milestone string `json:"milestone,omitempty" jsonschema:"milestone title to attach"`
State string `json:"state,omitempty" jsonschema:"close or reopen"`
}
type UploadReleaseAssetArgs ¶
type UploadReleaseAssetArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
TagName string `json:"tag_name" jsonschema:"tag of an existing release to attach the asset to"`
// Path is resolved by the server's filesystem provider, not by this
// handler: what the agent may read is decided by how the binary was
// started, not by the argument.
Path string `json:"path" jsonschema:"local file to upload, relative to the server's assets directory"`
Name string `json:"name,omitempty" jsonschema:"asset name shown on the release page; defaults to the file's base name"`
LinkType string `json:"link_type,omitempty" jsonschema:"other, runbook, image, or package; defaults to other"`
}
type UploadReleaseAssetRes ¶
type UploadReleaseAssetRes struct {
Asset ReleaseAsset `json:"asset"`
Size int64 `json:"size" jsonschema:"bytes uploaded"`
}
type UserSummary ¶
UserSummary identifies a user without the avatar URLs, web URLs and IDs that the full API representation carries.
type ViewIssueArgs ¶
type ViewIssueArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
IID int64 `json:"iid" jsonschema:"project-scoped issue number, the one shown as #123"`
WithNotes bool `json:"with_notes,omitempty" jsonschema:"include the comment thread; off by default because it can be long"`
}
type ViewIssueRes ¶
type ViewIssueRes struct {
Issue IssueDetail `json:"issue"`
}
type ViewMergeRequestArgs ¶
type ViewMergeRequestArgs struct {
Project string `json:"project,omitempty" jsonschema:"project path (group/project) or numeric ID; defaults to the server's configured project"`
IID int64 `json:"iid" jsonschema:"project-scoped merge request number, the one shown as !123"`
WithNotes bool `json:"with_notes,omitempty" jsonschema:"include the comment thread; off by default because it can be long"`
WithApprovals bool `json:"with_approvals,omitempty" jsonschema:"include who approved and how many approvals remain; costs one extra API call"`
}
type ViewMergeRequestRes ¶
type ViewMergeRequestRes struct {
MergeRequest MergeRequestDetail `json:"merge_request"`
}
type ViewProjectArgs ¶
type ViewProjectRes ¶
type ViewProjectRes struct {
Project ProjectDetail `json:"project"`
}
type ViewReleaseArgs ¶
type ViewReleaseRes ¶
type ViewReleaseRes struct {
Release ReleaseDetail `json:"release"`
}