gitlab

package
v0.0.0-...-ce3bea3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPerPage = 20

DefaultPerPage defines the default number of items per page for pagination.

View Source
const MaxPerPage = 100

MaxPerPage defines the maximum number of items per page allowed by GitLab.

Variables

View Source
var DefaultTools = []string{"all"}

DefaultTools defines the list of toolsets enabled by default.

Functions

func GetIssue

func GetIssue(getClient GetClientFn) (mcp.Tool, server.ToolHandlerFunc)

func getIssueTool(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {

func GetIssueComments

func GetIssueComments(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

GetIssueComments defines the MCP tool for retrieving issue comments/notes.

func GetIssueLabels

func GetIssueLabels(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

GetIssueLabels defines the MCP tool for retrieving the labels associated with an issue.

func GetMergeRequest

func GetMergeRequest(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

GetMergeRequest defines the MCP tool for retrieving details of a specific merge request.

func GetMergeRequestComments

func GetMergeRequestComments(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

GetMergeRequestComments defines the MCP tool for retrieving comments/notes for a specific merge request.

func GetProject

func GetProject(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

GetProject defines the MCP tool for retrieving a single GitLab project. Uses named return values to match the expected signature pattern. GetProject defines the MCP tool for retrieving a single GitLab project.

func GetProjectBranches

func GetProjectBranches(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

GetProjectBranches defines the MCP tool for listing branches in a project.

func GetProjectCommits

func GetProjectCommits(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

GetProjectCommits defines the MCP tool for listing commits in a project.

func GetProjectFile

func GetProjectFile(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

GetProjectFile defines the MCP tool for retrieving the content of a file in a project.

func InitToolsets

func InitToolsets(
	enabledToolsets []string,
	readOnly bool,
	getClient GetClientFn,

) (*toolsets.ToolsetGroup, error)

InitToolsets initializes the ToolsetGroup with GitLab-specific toolsets. It accepts a function to retrieve the GitLab client.

func ListIssues

func ListIssues(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

ListIssues defines the MCP tool for listing issues with filtering and pagination.

func ListMergeRequests

func ListMergeRequests(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

ListMergeRequests defines the MCP tool for listing merge requests with pagination and filtering.

func ListProjectFiles

func ListProjectFiles(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

ListProjectFiles defines the MCP tool for listing files in a project directory.

func ListProjects

func ListProjects(getClient GetClientFn) (tool mcp.Tool, handler server.ToolHandlerFunc)

ListProjects defines the MCP tool for listing GitLab projects.

func NewServer

func NewServer(appName, appVersion string) *server.MCPServer

NewServer creates a new MCP server instance with default options suitable for GitLab.

func OptionalBoolParam

func OptionalBoolParam(r *mcp.CallToolRequest, p string) (*bool, error)

OptionalBoolParam retrieves an optional boolean parameter from the request arguments. It returns a pointer to the boolean value if found and valid, or nil if not present. Returns an error if the parameter exists but is not a valid boolean.

func OptionalIntParam

func OptionalIntParam(r *mcp.CallToolRequest, p string) (int, error)

OptionalIntParam fetches an optional integer parameter, handling potential float64 from JSON.

func OptionalIntParamWithDefault

func OptionalIntParamWithDefault(r *mcp.CallToolRequest, p string, defaultValue int) (int, error)

OptionalIntParamWithDefault fetches an optional integer parameter, returning a default value if absent or error.

func OptionalPaginationParams

func OptionalPaginationParams(req *mcp.CallToolRequest) (page, perPage int, err error)

OptionalPaginationParams extracts page and per_page parameters from the request. It applies default and max values.

func OptionalParam

func OptionalParam[T any](r *mcp.CallToolRequest, p string) (T, error)

OptionalParam fetches an optional parameter, returns its zero value if absent, checks type if present.

func OptionalParamOK

func OptionalParamOK[T any](r *mcp.CallToolRequest, p string) (value T, ok bool, err error)

OptionalParamOK fetches an optional parameter, returning value, presence bool, and type error.

func OptionalTimeParam

func OptionalTimeParam(request *mcp.CallToolRequest, name string) (*time.Time, error)

OptionalTimeParam parses an optional ISO 8601 timestamp string parameter. It returns nil if the parameter is missing, empty, or null.

func WithPagination

func WithPagination() mcp.ToolOption

WithPagination returns a ToolOption to add standard 'page' and 'per_page' parameters. Parameters are optional by default.

Types

type GetClientFn

type GetClientFn func(context.Context) (*gl.Client, error)

GetClientFn defines the function signature for retrieving an initialized GitLab client. This allows decoupling toolset initialization from direct client creation.

Jump to

Keyboard shortcuts

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