Documentation
¶
Overview ¶
Package systemhooks implements MCP tools for GitLab instance system hooks.
The package wraps the GitLab System hooks API:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func DeleteURLVariable(ctx context.Context, client *gitlabclient.Client, input DeleteURLVariableInput) error
- func FormatHookMarkdown(item HookItem) *mcp.CallToolResult
- func FormatListMarkdown(output ListOutput) *mcp.CallToolResult
- func FormatTestMarkdown(output TestOutput) *mcp.CallToolResult
- func SetURLVariable(ctx context.Context, client *gitlabclient.Client, input SetURLVariableInput) error
- type AddInput
- type AddOutput
- type DeleteInput
- type DeleteURLVariableInput
- type EditInput
- type EditOutput
- type GetInput
- type GetOutput
- type HookEventItem
- type HookItem
- type HookURLVariable
- type ListInput
- type ListOutput
- type SetURLVariableInput
- type TestInput
- type TestOutput
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 system hook tools.
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete removes a system hook.
func DeleteURLVariable ¶
func DeleteURLVariable(ctx context.Context, client *gitlabclient.Client, input DeleteURLVariableInput) error
DeleteURLVariable deletes a URL variable from a system hook.
func FormatHookMarkdown ¶
func FormatHookMarkdown(item HookItem) *mcp.CallToolResult
FormatHookMarkdown formats a single system hook.
func FormatListMarkdown ¶
func FormatListMarkdown(output ListOutput) *mcp.CallToolResult
FormatListMarkdown formats a list of system hooks.
func FormatTestMarkdown ¶
func FormatTestMarkdown(output TestOutput) *mcp.CallToolResult
FormatTestMarkdown formats a hook test event result.
func SetURLVariable ¶
func SetURLVariable(ctx context.Context, client *gitlabclient.Client, input SetURLVariableInput) error
SetURLVariable creates or updates a URL variable for a system hook.
Types ¶
type AddInput ¶
type AddInput struct {
URL string `json:"url" jsonschema:"Hook URL to receive events,required"`
Name string `json:"name,omitempty" jsonschema:"Descriptive name for the hook"`
Description string `json:"description,omitempty" jsonschema:"Description for the hook"`
Token string `json:"token,omitempty" jsonschema:"Secret token for payload validation"`
SigningToken string `json:"signing_token,omitempty" jsonschema:"Write-only signing token for webhook signature validation"`
PushEvents *bool `json:"push_events,omitempty" jsonschema:"Trigger on push events"`
PushEventsBranchFilter string `json:"push_events_branch_filter,omitempty" jsonschema:"Branch filter for push events (wildcard, regex, or branch name)"`
BranchFilterStrategy string `json:"branch_filter_strategy,omitempty" jsonschema:"Branch filter strategy: wildcard, regex, or all_branches"`
TagPushEvents *bool `json:"tag_push_events,omitempty" jsonschema:"Trigger on tag push events"`
MergeRequestsEvents *bool `json:"merge_requests_events,omitempty" jsonschema:"Trigger on merge request events"`
RepositoryUpdateEvents *bool `json:"repository_update_events,omitempty" jsonschema:"Trigger on repository update events"`
EnableSSLVerification *bool `json:"enable_ssl_verification,omitempty" jsonschema:"Enable SSL verification for the hook URL"`
}
AddInput is the input for adding a system hook.
type AddOutput ¶
type AddOutput struct {
toolutil.HintableOutput
Hook HookItem `json:"hook"`
}
AddOutput wraps the added hook.
type DeleteInput ¶
type DeleteInput struct {
ID int64 `json:"id" jsonschema:"System hook ID to delete,required"`
}
DeleteInput is the input for deleting a system hook.
type DeleteURLVariableInput ¶
type DeleteURLVariableInput struct {
ID int64 `json:"id" jsonschema:"System hook ID,required"`
Key string `json:"key" jsonschema:"URL variable key name to delete,required"`
}
DeleteURLVariableInput is the input for deleting a system hook URL variable.
type EditInput ¶
type EditInput struct {
ID int64 `json:"id" jsonschema:"System hook ID to edit,required"`
URL string `json:"url,omitempty" jsonschema:"Updated hook URL"`
Name string `json:"name,omitempty" jsonschema:"Updated hook name"`
Description string `json:"description,omitempty" jsonschema:"Updated hook description"`
Token string `json:"token,omitempty" jsonschema:"Updated secret token for payload validation"`
SigningToken string `json:"signing_token,omitempty" jsonschema:"Updated write-only signing token for webhook signature validation"`
PushEvents *bool `json:"push_events,omitempty" jsonschema:"Trigger on push events"`
PushEventsBranchFilter string `json:"push_events_branch_filter,omitempty" jsonschema:"Branch filter for push events (wildcard, regex, or branch name)"`
BranchFilterStrategy string `json:"branch_filter_strategy,omitempty" jsonschema:"Branch filter strategy: wildcard, regex, or all_branches"`
TagPushEvents *bool `json:"tag_push_events,omitempty" jsonschema:"Trigger on tag push events"`
MergeRequestsEvents *bool `json:"merge_requests_events,omitempty" jsonschema:"Trigger on merge request events"`
RepositoryUpdateEvents *bool `json:"repository_update_events,omitempty" jsonschema:"Trigger on repository update events"`
EnableSSLVerification *bool `json:"enable_ssl_verification,omitempty" jsonschema:"Enable SSL verification for the hook URL"`
}
EditInput is the input for editing a system hook.
type EditOutput ¶
type EditOutput struct {
toolutil.HintableOutput
Hook HookItem `json:"hook"`
}
EditOutput wraps the edited hook.
func Edit ¶
func Edit(ctx context.Context, client *gitlabclient.Client, input EditInput) (EditOutput, error)
Edit updates an existing system hook.
type GetInput ¶
type GetInput struct {
ID int64 `json:"id" jsonschema:"System hook ID,required"`
}
GetInput is the input for getting a system hook.
type GetOutput ¶
type GetOutput struct {
toolutil.HintableOutput
Hook HookItem `json:"hook"`
}
GetOutput wraps a single hook.
type HookEventItem ¶
type HookEventItem struct {
EventName string `json:"event_name"`
Name string `json:"name"`
Path string `json:"path"`
ProjectID int64 `json:"project_id"`
OwnerName string `json:"owner_name"`
OwnerEmail string `json:"owner_email"`
}
HookEventItem represents a hook test event.
type HookItem ¶
type HookItem struct {
ID int64 `json:"id"`
URL string `json:"url"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
PushEvents bool `json:"push_events"`
TagPushEvents bool `json:"tag_push_events"`
MergeRequestsEvents bool `json:"merge_requests_events"`
RepositoryUpdateEvents bool `json:"repository_update_events"`
EnableSSLVerification bool `json:"enable_ssl_verification"`
URLVariables []HookURLVariable `json:"url_variables,omitempty"`
TokenPresent bool `json:"token_present"`
SigningTokenPresent bool `json:"signing_token_present"`
}
HookItem represents a system hook.
type HookURLVariable ¶
type HookURLVariable struct {
Key string `json:"key"`
}
HookURLVariable represents a masked URL variable configured on a system hook.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Hooks []HookItem `json:"hooks"`
}
ListOutput contains the list of system hooks.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, _ ListInput) (ListOutput, error)
List retrieves all system hooks.
type SetURLVariableInput ¶
type SetURLVariableInput struct {
ID int64 `json:"id" jsonschema:"System hook ID,required"`
Key string `json:"key" jsonschema:"URL variable key name,required"`
Value string `json:"value" jsonschema:"URL variable value,required"`
}
SetURLVariableInput is the input for creating or updating a system hook URL variable.
type TestInput ¶
type TestInput struct {
ID int64 `json:"id" jsonschema:"System hook ID to test,required"`
}
TestInput is the input for testing a system hook.
type TestOutput ¶
type TestOutput struct {
toolutil.HintableOutput
Event HookEventItem `json:"event"`
}
TestOutput wraps the test event result.
func Test ¶
func Test(ctx context.Context, client *gitlabclient.Client, input TestInput) (TestOutput, error)
Test triggers a test event for a system hook.