members

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package members implements MCP tools for GitLab project member operations.

The package wraps the GitLab Members API:

Index

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 ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for project member actions exposed as MCP tools. The list, get, get-inherited, add, edit, and delete routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).

func Delete

func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error

Delete removes a member from a project via the GitLab Project members API (DELETE /projects/:id/members/:user_id). Requires Maintainer role; the last Owner of a project cannot be removed.

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

func FormatMarkdown(v Output) string

FormatMarkdown renders a single member Output as Markdown.

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                  `` /* 234-byte string literal not displayed */
	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                  `` /* 238-byte string literal not displayed */
	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 project members (including inherited members from parent groups) via the GitLab Project members API (GET /projects/:id/members/all). Supports filtering by name or username via the Query field and pagination.

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 Add

func Add(ctx context.Context, client *gitlabclient.Client, input AddInput) (Output, error)

Add adds a user as a member of a project via the GitLab Project members API (POST /projects/:id/members). The user may be identified by either user_id or username. The AccessLevel must be one of 5/10/15/20/25/30/40/50/60; a MemberRoleID (Premium/Ultimate) may be provided instead to attach a custom role.

func Edit

func Edit(ctx context.Context, client *gitlabclient.Client, input EditInput) (Output, error)

Edit modifies an existing project member's access level, expiration date, or custom member role via the GitLab Project members API (PUT /projects/:id/members/:user_id). Requires at least the same access level as the target member.

func Get

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

Get retrieves a direct project member by user ID via the GitLab Project members API (GET /projects/:id/members/:user_id). Does not include members inherited from parent groups; use GetInherited for that.

func GetInherited

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

GetInherited retrieves a project member including membership inherited from any parent group via the GitLab Project members API (GET /projects/:id/members/all/:user_id).

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.

Jump to

Keyboard shortcuts

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