systemhooks

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

markdown.go provides Markdown formatting functions for system hook MCP tool output.

register.go wires systemhooks MCP tools to the MCP server.

Package systemhooks implements MCP tools for GitLab System Hooks API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

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

Delete removes 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 RegisterTools

func RegisterTools(server *mcp.Server, client *gitlabclient.Client)

RegisterTools registers all system hooks tools on the MCP server.

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

func Add

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

Add creates a new system 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 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.

func Get

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

Get retrieves a single system 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"`
}

HookItem represents a system hook.

type ListInput

type ListInput struct{}

ListInput is empty (no params).

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 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.

Jump to

Keyboard shortcuts

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