Documentation
¶
Overview ¶
Package namespaces implements MCP tools for GitLab namespace operations.
The package wraps the GitLab Namespaces API:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func FormatExistsMarkdown(out ExistsOutput) *mcp.CallToolResult
- func FormatExistsMarkdownString(out ExistsOutput) string
- func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
- func FormatListMarkdownString(out ListOutput) string
- func FormatMarkdown(out Output) *mcp.CallToolResult
- func FormatMarkdownString(out Output) string
- type ExistsInput
- type ExistsOutput
- type GetInput
- type ListInput
- type ListOutput
- type Output
- type SearchInput
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 namespace actions exposed through gitlab_user.
func FormatExistsMarkdown ¶
func FormatExistsMarkdown(out ExistsOutput) *mcp.CallToolResult
FormatExistsMarkdown formats a namespace existence check as a Markdown CallToolResult.
func FormatExistsMarkdownString ¶
func FormatExistsMarkdownString(out ExistsOutput) string
FormatExistsMarkdownString renders the availability answer as a card, with the alternative paths GitLab offered as the collection they are. The suggestions used to be joined into one line as they arrived, so a suggestion carrying Markdown was rendered as Markdown.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
FormatListMarkdown formats a list of namespaces as a Markdown CallToolResult.
func FormatListMarkdownString ¶
func FormatListMarkdownString(out ListOutput) string
FormatListMarkdownString renders a page of namespaces as the table a collection of objects sharing columns takes, headed with the count the response can vouch for rather than with the number of rows shown.
func FormatMarkdown ¶
func FormatMarkdown(out Output) *mcp.CallToolResult
FormatMarkdown formats a single namespace as a Markdown CallToolResult.
func FormatMarkdownString ¶
FormatMarkdownString renders one namespace as a card. Every optional field is written only when GitLab sent it: the administrator's figures, the compute-minute and storage limits a caller who may change them is shown, and the two subscription dates.
Types ¶
type ExistsInput ¶
type ExistsInput struct {
ID string `json:"id" jsonschema:"Namespace path to check for existence,required"`
ParentID int64 `json:"parent_id,omitempty" jsonschema:"Parent namespace ID to scope the check"`
}
ExistsInput contains parameters for checking namespace existence.
type ExistsOutput ¶
type ExistsOutput struct {
toolutil.HintableOutput
Exists bool `json:"exists"`
Suggests []string `json:"suggests,omitempty"`
}
ExistsOutput represents the result of a namespace existence check.
func Exists ¶
func Exists(ctx context.Context, client *gitlabclient.Client, input ExistsInput) (ExistsOutput, error)
Exists checks whether a namespace path is available.
A blank id is refused before any request, as Get refuses one. An empty id leaves an empty segment where the path belongs in namespaces/:id/exists, and a path of whitespace is one no namespace can take, so GitLab's answer for it, that nothing holds the path, would read as the path being free.
type GetInput ¶
type GetInput struct {
ID string `json:"id" jsonschema:"Namespace ID or path,required"`
}
GetInput contains parameters for getting a namespace by ID.
type ListInput ¶
type ListInput struct {
Search string `json:"search,omitempty" jsonschema:"Filter namespaces by search term"`
OwnedOnly bool `json:"owned_only,omitempty" jsonschema:"If true return only namespaces owned by the authenticated user"`
TopLevelOnly bool `json:"top_level_only,omitempty" jsonschema:"If true return only top-level namespaces"`
OrderBy string `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
Sort string `json:"sort,omitempty" jsonschema:"Sort direction for keyset-paginated results (asc, desc)"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
ListInput contains parameters for listing namespaces.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Namespaces []Output `json:"namespaces"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput represents a paginated list of namespaces.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List returns a paginated list of namespaces visible to the user.
func Search ¶
func Search(ctx context.Context, client *gitlabclient.Client, input SearchInput) (ListOutput, error)
Search searches namespaces by query string.
A blank query is refused before any request. client-go leaves an empty search parameter off the request, and GitLab filters by one only when it is present, so either would be answered with every namespace the caller can see, presented as the ones matching a search.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int64 `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Kind string `json:"kind"`
FullPath string `json:"full_path"`
ParentID int64 `json:"parent_id,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
WebURL string `json:"web_url,omitempty"`
MembersCountWithDescendants int64 `json:"members_count_with_descendants,omitempty"`
// ProjectsCount and RootRepositorySize are sent to an administrator asking
// about a group.
ProjectsCount int64 `json:"projects_count,omitempty"`
RootRepositorySize int64 `json:"root_repository_size,omitempty"`
// The compute-minute and purchased-storage fields are sent to a caller
// allowed to change the namespace's limits.
AdditionalPurchasedStorageSize *int64 `json:"additional_purchased_storage_size,omitempty"`
AdditionalPurchasedStorageEndsOn string `json:"additional_purchased_storage_ends_on,omitempty"`
BillableMembersCount int64 `json:"billable_members_count,omitempty" tier:"premium"`
Plan string `json:"plan,omitempty" tier:"premium"`
TrialEndsOn string `json:"trial_ends_on,omitempty" tier:"premium"`
Trial bool `json:"trial,omitempty" tier:"premium"`
MaxSeatsUsed *int64 `json:"max_seats_used,omitempty"`
SeatsInUse *int64 `json:"seats_in_use,omitempty"`
// MaxSeatsUsedChangedAt and EndDate are sent for a namespace that has a
// subscription.
MaxSeatsUsedChangedAt string `json:"max_seats_used_changed_at,omitempty"`
EndDate string `json:"end_date,omitempty"`
// CIMinutesUsage is sent for a top-level namespace to its owner or an
// administrator, on an enterprise build from GitLab 19.4.
CIMinutesUsage *toolutil.CIMinutesUsageOutput `json:"ci_minutes_usage,omitempty"`
}
Output represents a single namespace.
func Get ¶
Get retrieves a single namespace by ID or path.
A blank id is refused before any request. The schema's required does not refuse an empty string, and GitLab's router folds the path namespaces/ onto the listing route, so an empty id would be answered with the caller's list of namespaces rather than with the one namespace this action promises.
type SearchInput ¶
type SearchInput struct {
Query string `json:"query" jsonschema:"Search query string for namespaces,required"`
}
SearchInput contains parameters for searching namespaces.