integrations

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 11 Imported by: 0

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:

Index

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

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

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

func FormatGetGroupDatadogMarkdown(out GetGroupDatadogOutput) *mcp.CallToolResult

FormatGetGroupDatadogMarkdown renders the read output for the group-level Datadog integration.

func FormatGetGroupIntegrationMarkdown

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

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

func FormatSetGroupDatadogMarkdown(out SetGroupDatadogOutput) *mcp.CallToolResult

FormatSetGroupDatadogMarkdown renders the mutate output for the group-level Datadog integration.

func FormatSetGroupIntegrationMarkdown

func FormatSetGroupIntegrationMarkdown(out SetGroupIntegrationOutput) *mcp.CallToolResult

FormatSetGroupIntegrationMarkdown formats the generic group integration upsert response.

func FormatSetIntegrationMarkdown

func FormatSetIntegrationMarkdown(out SetIntegrationOutput) *mcp.CallToolResult

FormatSetIntegrationMarkdown formats the generic project integration upsert response.

Types

type DeleteGroupDatadogInput

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

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

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

type GetGroupDatadogOutput struct {
	toolutil.HintableOutput
	Integration GroupDatadogItem `json:"integration"`
}

GetGroupDatadogOutput is the output of GetGroupDatadog.

func GetGroupDatadog

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

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

type GetGroupIntegrationOutput struct {
	toolutil.HintableOutput
	Integration IntegrationItem `json:"integration"`
}

GetGroupIntegrationOutput is the output for a single group integration.

func GetGroupIntegration

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.

func Get

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

Get retrieves a specific integration by slug, dispatching to the typed client-go method.

type GroupDatadogItem

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"`

	Properties *GroupDatadogProperties `json:"properties,omitempty" jsonschema:"The Datadog configuration GitLab returns for the integration"`
}

GroupDatadogItem is a JSON-serializable view of gl.GroupDatadogIntegration returned by the group-level Datadog integration tools.

The Datadog configuration has one home here, the nested Properties object, which is what GitLab's own record says the endpoint sends (APIEntitiesIntegration carries `properties` and no flat Datadog field). The flat copies this type published beside it during v2 are gone in v3; client-go still declares its own deprecated flat fields, and they are read only as the fallback below.

The embedded gl.Integration base fields (identity, lifecycle, and the full set of event trigger flags) stay flattened; event flags are plain bool in client-go and are surfaced unconditionally (no omitempty) so a false value is explicit in the output.

type GroupDatadogProperties

type GroupDatadogProperties struct {
	APIURL              string `json:"api_url"`
	DatadogEnv          string `json:"datadog_env"`
	DatadogService      string `json:"datadog_service"`
	DatadogSite         string `json:"datadog_site"`
	DatadogTags         string `json:"datadog_tags"`
	DatadogCIVisibility bool   `json:"datadog_ci_visibility"`
	ArchiveTraceEvents  bool   `json:"archive_trace_events"`
}

GroupDatadogProperties mirrors gl.GroupDatadogIntegrationProperties field for field (same plain types): the nested "properties" object GitLab returns with the group Datadog integration. It is the canonical home of the Datadog configuration, and the only one GroupDatadogItem publishes.

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

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

type ListGroupIntegrationsOutput struct {
	toolutil.HintableOutput
	Integrations []IntegrationItem `json:"integrations"`
}

ListGroupIntegrationsOutput is the output for listing group integrations.

func ListGroupIntegrations

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

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"`
	DatadogCIVisibility  *bool                `` /* 132-byte string literal not displayed */
	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

type SetGroupDatadogOutput struct {
	toolutil.HintableOutput
	Integration GroupDatadogItem `json:"integration"`
}

SetGroupDatadogOutput is the output of SetGroupDatadog.

func SetGroupDatadog

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

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

type SetGroupIntegrationOutput struct {
	toolutil.HintableOutput
	Integration IntegrationItem `json:"integration"`
}

SetGroupIntegrationOutput is the output after upserting a group integration.

func SetGroupIntegration

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

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

type SetIntegrationOutput struct {
	toolutil.HintableOutput
	Integration IntegrationItem `json:"integration"`
}

SetIntegrationOutput is the output after upserting a project integration.

func SetIntegration

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.

Jump to

Keyboard shortcuts

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