namespaces

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package namespaces implements MCP tools for GitLab namespace operations including listing, getting, checking existence, and searching namespaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 a namespace existence result as a Markdown string.

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 list of namespaces as a Markdown string.

func FormatMarkdown

func FormatMarkdown(out Output) *mcp.CallToolResult

FormatMarkdown formats a single namespace as a Markdown CallToolResult.

func FormatMarkdownString

func FormatMarkdownString(out Output) string

FormatMarkdownString renders a single namespace as a Markdown string.

func RegisterMeta

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

RegisterMeta registers the gitlab_namespace meta-tool.

func RegisterTools

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

RegisterTools registers individual namespace tools.

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.

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"`
	Page         int64  `json:"page,omitempty" jsonschema:"Page number for pagination (default 1)"`
	PerPage      int64  `json:"per_page,omitempty" jsonschema:"Number of items per page (default 20, max 100)"`
}

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(ctx context.Context, client *gitlabclient.Client, input SearchInput) (ListOutput, error)

Search searches namespaces by query string.

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"`
	BillableMembersCount        int64  `json:"billable_members_count,omitempty"`
	Plan                        string `json:"plan,omitempty"`
	Trial                       bool   `json:"trial,omitempty"`
}

Output represents a single namespace.

func Get

func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)

Get retrieves a single namespace by ID or path. Uses a raw HTTP request to work around upstream client-go issue where GetNamespace expects a single JSON object but some GitLab versions return an array for path-based lookups.

type SearchInput

type SearchInput struct {
	Query string `json:"query" jsonschema:"Search query string for namespaces,required"`
}

SearchInput contains parameters for searching namespaces.

Jump to

Keyboard shortcuts

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