Documentation
¶
Overview ¶
Package integrations implements MCP tools for GitLab project and group integrations.
It wraps the GitLab Services service from client-go v2. The generic tools list, get, and delete project-level integrations by slug, while integration-specific tools handle configuration details such as Jira and group-level Datadog settings. The package also provides Markdown rendering for project and group integration responses.
The package wraps two GitLab API surfaces:
- Project integrations: https://docs.gitlab.com/api/integrations/
- Group integrations: https://docs.gitlab.com/api/group_integrations/
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func DeleteGroupDatadog(ctx context.Context, client *gitlabclient.Client, ...) error
- func DeleteGroupIntegration(ctx context.Context, client *gitlabclient.Client, ...) error
- func FormatGetGroupDatadogMarkdown(out GetGroupDatadogOutput) *mcp.CallToolResult
- func FormatGetGroupIntegrationMarkdown(out GetGroupIntegrationOutput) *mcp.CallToolResult
- func FormatGetMarkdown(out GetOutput) *mcp.CallToolResult
- func FormatListGroupIntegrationsMarkdown(out ListGroupIntegrationsOutput) *mcp.CallToolResult
- func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
- func FormatSetGroupDatadogMarkdown(out SetGroupDatadogOutput) *mcp.CallToolResult
- func FormatSetGroupIntegrationMarkdown(out SetGroupIntegrationOutput) *mcp.CallToolResult
- func FormatSetIntegrationMarkdown(out SetIntegrationOutput) *mcp.CallToolResult
- type DeleteGroupDatadogInput
- type DeleteGroupIntegrationInput
- type DeleteInput
- type GetGroupDatadogInput
- type GetGroupDatadogOutput
- type GetGroupIntegrationInput
- type GetGroupIntegrationOutput
- type GetInput
- type GetOutput
- type GroupDatadogItem
- type IntegrationItem
- type ListGroupIntegrationsInput
- type ListGroupIntegrationsOutput
- type ListInput
- type ListOutput
- type SetGroupDatadogInput
- type SetGroupDatadogOutput
- type SetGroupIntegrationInput
- type SetGroupIntegrationOutput
- type SetIntegrationInput
- type SetIntegrationOutput
- type SetJiraInput
- type SetJiraOutput
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 project integration actions.
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete removes/disables a specific integration from a project.
func DeleteGroupDatadog ¶ added in v2.2.0
func DeleteGroupDatadog(ctx context.Context, client *gitlabclient.Client, input DeleteGroupDatadogInput) error
DeleteGroupDatadog removes the Datadog integration configuration from a group. Requires Owner role on the group; deletion is irreversible and clears the stored API key.
func DeleteGroupIntegration ¶ added in v2.3.0
func DeleteGroupIntegration(ctx context.Context, client *gitlabclient.Client, input DeleteGroupIntegrationInput) error
DeleteGroupIntegration disables/removes a group integration by slug via raw REST DELETE.
func FormatGetGroupDatadogMarkdown ¶ added in v2.2.0
func FormatGetGroupDatadogMarkdown(out GetGroupDatadogOutput) *mcp.CallToolResult
FormatGetGroupDatadogMarkdown renders the read output for the group-level Datadog integration.
func FormatGetGroupIntegrationMarkdown ¶ added in v2.3.0
func FormatGetGroupIntegrationMarkdown(out GetGroupIntegrationOutput) *mcp.CallToolResult
FormatGetGroupIntegrationMarkdown formats a single group integration.
func FormatGetMarkdown ¶
func FormatGetMarkdown(out GetOutput) *mcp.CallToolResult
FormatGetMarkdown formats a single integration.
func FormatListGroupIntegrationsMarkdown ¶ added in v2.3.0
func FormatListGroupIntegrationsMarkdown(out ListGroupIntegrationsOutput) *mcp.CallToolResult
FormatListGroupIntegrationsMarkdown formats a list of group integrations.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
FormatListMarkdown formats a list of integrations.
func FormatSetGroupDatadogMarkdown ¶ added in v2.2.0
func FormatSetGroupDatadogMarkdown(out SetGroupDatadogOutput) *mcp.CallToolResult
FormatSetGroupDatadogMarkdown renders the mutate output for the group-level Datadog integration.
func FormatSetGroupIntegrationMarkdown ¶ added in v2.3.0
func FormatSetGroupIntegrationMarkdown(out SetGroupIntegrationOutput) *mcp.CallToolResult
FormatSetGroupIntegrationMarkdown formats the generic group integration upsert response.
func FormatSetIntegrationMarkdown ¶ added in v2.3.0
func FormatSetIntegrationMarkdown(out SetIntegrationOutput) *mcp.CallToolResult
FormatSetIntegrationMarkdown formats the generic project integration upsert response.
Types ¶
type DeleteGroupDatadogInput ¶ added in v2.2.0
type DeleteGroupDatadogInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
}
DeleteGroupDatadogInput is the input for removing the Datadog integration from a group.
type DeleteGroupIntegrationInput ¶ added in v2.3.0
type DeleteGroupIntegrationInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
Slug string `json:"slug" jsonschema:"Integration slug to disable (e.g. slack, jira, harbor),required"`
}
DeleteGroupIntegrationInput is the input for disabling a group integration by slug.
type DeleteInput ¶
type DeleteInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Slug string `` /* 307-byte string literal not displayed */
}
DeleteInput is the input for deleting/disabling an integration.
type GetGroupDatadogInput ¶ added in v2.2.0
type GetGroupDatadogInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
}
GetGroupDatadogInput is the input for fetching the Datadog integration of a group.
type GetGroupDatadogOutput ¶ added in v2.2.0
type GetGroupDatadogOutput struct {
toolutil.HintableOutput
Integration GroupDatadogItem `json:"integration"`
}
GetGroupDatadogOutput is the output of GetGroupDatadog.
func GetGroupDatadog ¶ added in v2.2.0
func GetGroupDatadog(ctx context.Context, client *gitlabclient.Client, input GetGroupDatadogInput) (GetGroupDatadogOutput, error)
GetGroupDatadog retrieves the Datadog integration configured for a group. Requires Owner role and GitLab Premium/Ultimate (self-managed EE or GitLab.com).
type GetGroupIntegrationInput ¶ added in v2.3.0
type GetGroupIntegrationInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
Slug string `` /* 143-byte string literal not displayed */
}
GetGroupIntegrationInput is the input for reading one group integration by slug.
type GetGroupIntegrationOutput ¶ added in v2.3.0
type GetGroupIntegrationOutput struct {
toolutil.HintableOutput
Integration IntegrationItem `json:"integration"`
}
GetGroupIntegrationOutput is the output for a single group integration.
func GetGroupIntegration ¶ added in v2.3.0
func GetGroupIntegration(ctx context.Context, client *gitlabclient.Client, input GetGroupIntegrationInput) (GetGroupIntegrationOutput, error)
GetGroupIntegration reads one group integration by slug via raw REST.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Slug string `` /* 307-byte string literal not displayed */
}
GetInput is the input for getting an integration by slug.
type GetOutput ¶
type GetOutput struct {
toolutil.HintableOutput
Integration IntegrationItem `json:"integration"`
}
GetOutput is the output for a single integration.
type GroupDatadogItem ¶ added in v2.2.0
type GroupDatadogItem struct {
ID int64 `json:"id"`
Title string `json:"title"`
Slug string `json:"slug"`
Active bool `json:"active"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
AlertEvents bool `json:"alert_events"`
CommitEvents bool `json:"commit_events"`
ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
ConfidentialNoteEvents bool `json:"confidential_note_events"`
DeploymentEvents bool `json:"deployment_events"`
GroupConfidentialMentionEvents bool `json:"group_confidential_mention_events"`
GroupMentionEvents bool `json:"group_mention_events"`
IncidentEvents bool `json:"incident_events"`
IssuesEvents bool `json:"issues_events"`
JobEvents bool `json:"job_events"`
MergeRequestsEvents bool `json:"merge_requests_events"`
NoteEvents bool `json:"note_events"`
PipelineEvents bool `json:"pipeline_events"`
PushEvents bool `json:"push_events"`
TagPushEvents bool `json:"tag_push_events"`
VulnerabilityEvents bool `json:"vulnerability_events"`
WikiPageEvents bool `json:"wiki_page_events"`
CommentOnEventEnabled bool `json:"comment_on_event_enabled"`
Inherited bool `json:"inherited"`
APIURL string `json:"api_url,omitempty"`
DatadogEnv string `json:"datadog_env,omitempty"`
DatadogService string `json:"datadog_service,omitempty"`
DatadogSite string `json:"datadog_site,omitempty"`
DatadogTags string `json:"datadog_tags,omitempty"`
ArchiveTraceEvents *bool `json:"archive_trace_events,omitempty"`
}
GroupDatadogItem is a JSON-serializable view of gl.GroupDatadogIntegration returned by the group-level Datadog integration tools. The struct flattens the embedded gl.Integration base fields (identity, lifecycle, and the full set of event trigger flags) and the Datadog-specific fields so the LLM-facing schema stays stable even when client-go adds new embedded types. The event flags are plain bool in client-go and are surfaced unconditionally (no omitempty) so a false value is explicit in the output.
type IntegrationItem ¶
type IntegrationItem struct {
ID int64 `json:"id"`
Title string `json:"title"`
Slug string `json:"slug"`
Active bool `json:"active"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
AlertEvents bool `json:"alert_events"`
CommitEvents bool `json:"commit_events"`
ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
ConfidentialNoteEvents bool `json:"confidential_note_events"`
DeploymentEvents bool `json:"deployment_events"`
GroupConfidentialMentionEvents bool `json:"group_confidential_mention_events"`
GroupMentionEvents bool `json:"group_mention_events"`
IncidentEvents bool `json:"incident_events"`
IssuesEvents bool `json:"issues_events"`
JobEvents bool `json:"job_events"`
MergeRequestsEvents bool `json:"merge_requests_events"`
NoteEvents bool `json:"note_events"`
PipelineEvents bool `json:"pipeline_events"`
PushEvents bool `json:"push_events"`
TagPushEvents bool `json:"tag_push_events"`
VulnerabilityEvents bool `json:"vulnerability_events"`
WikiPageEvents bool `json:"wiki_page_events"`
CommentOnEventEnabled bool `json:"comment_on_event_enabled"`
Inherited bool `json:"inherited"`
}
IntegrationItem is a JSON-serializable view of gl.Integration (the base struct embedded by every project service/integration). It mirrors every field of the client-go struct: identity (id, title, slug), lifecycle (active, created_at, updated_at, inherited), and the full set of event trigger flags returned by the GitLab API. All event flags are plain bool in client-go and are surfaced unconditionally (no omitempty) so a false value is explicit in the output.
type ListGroupIntegrationsInput ¶ added in v2.3.0
type ListGroupIntegrationsInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
}
ListGroupIntegrationsInput is the input for listing a group's active integrations.
type ListGroupIntegrationsOutput ¶ added in v2.3.0
type ListGroupIntegrationsOutput struct {
toolutil.HintableOutput
Integrations []IntegrationItem `json:"integrations"`
}
ListGroupIntegrationsOutput is the output for listing group integrations.
func ListGroupIntegrations ¶ added in v2.3.0
func ListGroupIntegrations(ctx context.Context, client *gitlabclient.Client, input ListGroupIntegrationsInput) (ListGroupIntegrationsOutput, error)
ListGroupIntegrations returns all active integrations configured on a group.
type ListInput ¶
type ListInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
}
ListInput is the input for listing project integrations.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Integrations []IntegrationItem `json:"integrations"`
}
ListOutput is the output for listing integrations.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List returns all integrations for a project.
type SetGroupDatadogInput ¶ added in v2.2.0
type SetGroupDatadogInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
APIKey string `json:"api_key,omitempty" jsonschema:"Datadog API key (write-only; never returned by the get endpoint)"`
APIURL string `json:"api_url,omitempty" jsonschema:"Datadog API URL (e.g. https://api.datadoghq.com)"`
DatadogEnv string `json:"datadog_env,omitempty" jsonschema:"Datadog env tag forwarded with every log/metric"`
DatadogService string `json:"datadog_service,omitempty" jsonschema:"Datadog service tag forwarded with every log/metric"`
DatadogSite string `` /* 147-byte string literal not displayed */
DatadogTags string `json:"datadog_tags,omitempty" jsonschema:"Comma-separated Datadog tags forwarded with every log/metric"`
ArchiveTraceEvents *bool `json:"archive_trace_events,omitempty" jsonschema:"Forward CI job trace events to Datadog"`
UseInheritedSettings *bool `` /* 177-byte string literal not displayed */
}
SetGroupDatadogInput is the input for creating or updating the Datadog integration of a group. At least one Datadog field must be set, or UseInheritedSettings=true to inherit settings from an ancestor group.
type SetGroupDatadogOutput ¶ added in v2.2.0
type SetGroupDatadogOutput struct {
toolutil.HintableOutput
Integration GroupDatadogItem `json:"integration"`
}
SetGroupDatadogOutput is the output of SetGroupDatadog.
func SetGroupDatadog ¶ added in v2.2.0
func SetGroupDatadog(ctx context.Context, client *gitlabclient.Client, input SetGroupDatadogInput) (SetGroupDatadogOutput, error)
SetGroupDatadog creates or updates the Datadog integration for a group. Requires Owner role and GitLab Premium/Ultimate (self-managed EE or GitLab.com).
type SetGroupIntegrationInput ¶ added in v2.3.0
type SetGroupIntegrationInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
Slug string `` /* 185-byte string literal not displayed */
Config map[string]any `` /* 170-byte string literal not displayed */
}
SetGroupIntegrationInput is the input for the generic group integration upsert.
type SetGroupIntegrationOutput ¶ added in v2.3.0
type SetGroupIntegrationOutput struct {
toolutil.HintableOutput
Integration IntegrationItem `json:"integration"`
}
SetGroupIntegrationOutput is the output after upserting a group integration.
func SetGroupIntegration ¶ added in v2.3.0
func SetGroupIntegration(ctx context.Context, client *gitlabclient.Client, input SetGroupIntegrationInput) (SetGroupIntegrationOutput, error)
SetGroupIntegration creates or updates an arbitrary group integration by slug via raw REST PUT, passing the caller-supplied config object through as the request body.
type SetIntegrationInput ¶ added in v2.3.0
type SetIntegrationInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Slug string `` /* 190-byte string literal not displayed */
Config map[string]any `` /* 322-byte string literal not displayed */
}
SetIntegrationInput is the input for the generic project integration upsert.
Unlike the typed per-integration setters (e.g. set_jira_integration), this action accepts any integration slug plus a free-form config object carrying that integration's documented parameters. The config map is passed through verbatim as the PUT request body, so the model supplies exactly the fields listed for the chosen slug in doc/api/integrations.md.
type SetIntegrationOutput ¶ added in v2.3.0
type SetIntegrationOutput struct {
toolutil.HintableOutput
Integration IntegrationItem `json:"integration"`
}
SetIntegrationOutput is the output after upserting a project integration.
func SetIntegration ¶ added in v2.3.0
func SetIntegration(ctx context.Context, client *gitlabclient.Client, input SetIntegrationInput) (SetIntegrationOutput, error)
SetIntegration creates or updates an arbitrary project integration by slug.
It issues a raw REST PUT against projects/{id}/integrations/{slug} with the caller-supplied config object as the request body, then decodes the resulting integration into the shared IntegrationItem shape. A nil config is tolerated (sent as an empty body), so the handler never panics on missing configuration.
type SetJiraInput ¶
type SetJiraInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
URL string `json:"url" jsonschema:"Jira instance base URL,required"`
Username string `json:"username,omitempty" jsonschema:"Jira username"`
Password string `json:"password,omitempty" jsonschema:"Jira password or API token"`
Active *bool `json:"active,omitempty" jsonschema:"Enable or disable the integration"`
APIURL string `json:"api_url,omitempty" jsonschema:"Jira API URL (overrides base URL)"`
JiraAuthType *int64 `json:"jira_auth_type,omitempty" jsonschema:"Jira auth type (0=basic, 1=token)"`
JiraIssuePrefix string `json:"jira_issue_prefix,omitempty" jsonschema:"Jira issue key prefix"`
JiraIssueRegex string `json:"jira_issue_regex,omitempty" jsonschema:"Custom regex for Jira issue keys"`
JiraIssueTransitionAutomatic *bool `json:"jira_issue_transition_automatic,omitempty" jsonschema:"Auto-transition Jira issues"`
JiraIssueTransitionID string `json:"jira_issue_transition_id,omitempty" jsonschema:"Jira transition ID"`
CommitEvents *bool `json:"commit_events,omitempty" jsonschema:"Trigger on commit events"`
MergeRequestsEvents *bool `json:"merge_requests_events,omitempty" jsonschema:"Trigger on merge request events"`
CommentOnEventEnabled *bool `json:"comment_on_event_enabled,omitempty" jsonschema:"Add comments on Jira issues for events"`
IssuesEnabled *bool `json:"issues_enabled,omitempty" jsonschema:"Enable Jira issues integration"`
ProjectKeys []string `json:"project_keys,omitempty" jsonschema:"Jira project keys to restrict (used when issues_enabled is true)"`
UseInheritedSettings *bool `json:"use_inherited_settings,omitempty" jsonschema:"Use inherited settings from group"`
// Fields added in client-go v2.42.0.
VulnerabilitiesEnabled *bool `json:"vulnerabilities_enabled,omitempty" jsonschema:"Create Jira issues for vulnerabilities"`
VulnerabilitiesIssueType *int64 `` /* 144-byte string literal not displayed */
ProjectKey string `` /* 137-byte string literal not displayed */
CustomizeJiraIssueEnabled *bool `json:"customize_jira_issue_enabled,omitempty" jsonschema:"Customize the Jira issue created for vulnerabilities"`
JiraCheckEnabled *bool `json:"jira_check_enabled,omitempty" jsonschema:"Require commits/MRs to reference a Jira issue"`
JiraExistsCheckEnabled *bool `json:"jira_exists_check_enabled,omitempty" jsonschema:"Require that the referenced Jira issue exists"`
JiraAssigneeCheckEnabled *bool `json:"jira_assignee_check_enabled,omitempty" jsonschema:"Require the referenced Jira issue to have an assignee"`
JiraStatusCheckEnabled *bool `json:"jira_status_check_enabled,omitempty" jsonschema:"Require the referenced Jira issue to be in an allowed status"`
JiraAllowedStatusesAsString string `` /* 145-byte string literal not displayed */
}
SetJiraInput is the input for configuring the Jira integration.
type SetJiraOutput ¶
type SetJiraOutput struct {
toolutil.HintableOutput
Integration IntegrationItem `json:"integration"`
}
SetJiraOutput is the output after configuring Jira.
func SetJira ¶
func SetJira(ctx context.Context, client *gitlabclient.Client, input SetJiraInput) (SetJiraOutput, error)
SetJira configures the Jira integration for a project.