Documentation
¶
Overview ¶
Package members implements MCP tool handlers for GitLab project member operations including listing all members (with inherited) and providing human-readable access level descriptions. It wraps the ProjectMembers service from client-go v2.
Index ¶
- func AccessLevelDescription(level gl.AccessLevelValue) stringdeprecated
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func FormatListMarkdown(v ListOutput) *mcp.CallToolResult
- func FormatListMarkdownString(v ListOutput) string
- func FormatMarkdown(v Output) string
- func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
- type AddInput
- type DeleteInput
- type EditInput
- type GetInput
- type ListInput
- type ListOutput
- type Output
- func Add(ctx context.Context, client *gitlabclient.Client, input AddInput) (Output, error)
- func Edit(ctx context.Context, client *gitlabclient.Client, input EditInput) (Output, error)
- func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)
- func GetInherited(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)
- func ToOutput(m *gl.ProjectMember) Output
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessLevelDescription
deprecated
func AccessLevelDescription(level gl.AccessLevelValue) string
AccessLevelDescription delegates to toolutil.AccessLevelDescription.
Deprecated: Import toolutil.AccessLevelDescription directly instead.
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete removes a member from a project.
func FormatListMarkdown ¶
func FormatListMarkdown(v ListOutput) *mcp.CallToolResult
FormatListMarkdown returns a Markdown MCP tool result for a ListOutput.
func FormatListMarkdownString ¶
func FormatListMarkdownString(v ListOutput) string
FormatListMarkdownString renders a ListOutput as a Markdown table string.
func FormatMarkdown ¶
FormatMarkdown renders a single member Output as Markdown.
func RegisterTools ¶
func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
RegisterTools registers member-related tools on the MCP server.
Types ¶
type AddInput ¶
type AddInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
UserID int64 `json:"user_id,omitempty" jsonschema:"User ID to add (provide user_id or username),required"`
Username string `json:"username,omitempty" jsonschema:"Username to add (provide user_id or username)"`
AccessLevel int `json:"access_level" jsonschema:"Access level (10=Guest, 20=Reporter, 30=Developer, 40=Maintainer, 50=Owner)"`
ExpiresAt string `json:"expires_at,omitempty" jsonschema:"Membership expiration date (YYYY-MM-DD)"`
MemberRoleID int64 `json:"member_role_id,omitempty" jsonschema:"Custom member role ID"`
}
AddInput defines parameters for adding a project member.
type DeleteInput ¶
type DeleteInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
UserID int64 `json:"user_id" jsonschema:"User ID of the member to remove,required"`
}
DeleteInput defines parameters for removing a project member.
type EditInput ¶
type EditInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
UserID int64 `json:"user_id" jsonschema:"User ID of the member to edit,required"`
AccessLevel int `json:"access_level" jsonschema:"New access level (10=Guest, 20=Reporter, 30=Developer, 40=Maintainer, 50=Owner)"`
ExpiresAt string `json:"expires_at,omitempty" jsonschema:"Membership expiration date (YYYY-MM-DD)"`
MemberRoleID int64 `json:"member_role_id,omitempty" jsonschema:"Custom member role ID"`
}
EditInput defines parameters for editing a project member.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
UserID int64 `json:"user_id" jsonschema:"User ID of the member,required"`
}
GetInput defines parameters for retrieving a single project member.
type ListInput ¶
type ListInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Query string `json:"query,omitempty" jsonschema:"Filter members by name or username"`
toolutil.PaginationInput
}
ListInput defines parameters for listing project members.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Members []Output `json:"members"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput holds a paginated list of members.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves all members of a GitLab project, including inherited members from parent groups. Supports filtering by name or username via the Query field and pagination. Returns the member list with pagination metadata.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int64 `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state"`
AvatarURL string `json:"avatar_url,omitempty"`
AccessLevel int `json:"access_level"`
AccessLevelDescription string `json:"access_level_description"`
WebURL string `json:"web_url"`
CreatedAt string `json:"created_at,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
Email string `json:"email,omitempty"`
MemberRoleName string `json:"member_role_name,omitempty"`
IsUsingSeat bool `json:"is_using_seat,omitempty"`
}
Output represents a project or group member.
func GetInherited ¶
GetInherited retrieves a project member including inherited membership.
func ToOutput ¶
func ToOutput(m *gl.ProjectMember) Output
ToOutput converts a GitLab API gl.ProjectMember to the MCP tool output format, including a human-readable access level description derived from the numeric access level value.