broadcastmessages

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package broadcastmessages implements MCP tool handlers for GitLab broadcast messages. It wraps the BroadcastMessagesService from client-go v2. These are admin-only endpoints requiring administrator access.

markdown.go provides Markdown formatting functions for broadcast message MCP tool output.

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

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 broadcast message (admin-only).

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) *mcp.CallToolResult

FormatListMarkdown formats broadcast messages list as markdown.

func FormatMessageMarkdown

func FormatMessageMarkdown(item MessageItem) *mcp.CallToolResult

FormatMessageMarkdown formats a single broadcast message as markdown.

func RegisterTools

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

RegisterTools registers all broadcast message tools on the MCP server.

Types

type CreateInput

type CreateInput struct {
	Message            string  `json:"message" jsonschema:"Message text. Supports Markdown.,required"`
	StartsAt           string  `json:"starts_at,omitempty" jsonschema:"Start time in ISO 8601 format"`
	EndsAt             string  `json:"ends_at,omitempty" jsonschema:"End time in ISO 8601 format"`
	Font               string  `json:"font,omitempty" jsonschema:"Font for the message"`
	TargetAccessLevels []int64 `` /* 133-byte string literal not displayed */
	TargetPath         string  `json:"target_path,omitempty" jsonschema:"Target path to show message on"`
	BroadcastType      string  `json:"broadcast_type,omitempty" jsonschema:"Type: banner or notification"`
	Dismissable        *bool   `json:"dismissable,omitempty" jsonschema:"Whether message can be dismissed"`
	Theme              string  `json:"theme,omitempty" jsonschema:"Theme: indigo, light-indigo, blue, light-blue, green, light-green, red, light-red"`
}

CreateInput is the input for creating a broadcast message.

type CreateOutput

type CreateOutput struct {
	toolutil.HintableOutput
	Message MessageItem `json:"message"`
}

CreateOutput contains the created broadcast message.

func Create

func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (CreateOutput, error)

Create creates a new broadcast message (admin-only).

type DeleteInput

type DeleteInput struct {
	ID int64 `json:"id" jsonschema:"Broadcast message ID,required"`
}

DeleteInput is the input for deleting a broadcast message.

type GetInput

type GetInput struct {
	ID int64 `json:"id" jsonschema:"Broadcast message ID,required"`
}

GetInput is the input for getting a broadcast message.

type GetOutput

type GetOutput struct {
	toolutil.HintableOutput
	Message MessageItem `json:"message"`
}

GetOutput contains a single broadcast message.

func Get

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

Get retrieves a specific broadcast message by ID.

type ListInput

type ListInput struct {
	Page    int64 `json:"page,omitempty" jsonschema:"Page number"`
	PerPage int64 `json:"per_page,omitempty" jsonschema:"Items per page"`
}

ListInput is the input for listing broadcast messages.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	Messages   []MessageItem             `json:"messages"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListOutput is the output for listing broadcast messages.

func List

func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)

List retrieves all broadcast messages.

type MessageItem

type MessageItem struct {
	ID                 int64   `json:"id"`
	Message            string  `json:"message"`
	StartsAt           string  `json:"starts_at,omitempty"`
	EndsAt             string  `json:"ends_at,omitempty"`
	Font               string  `json:"font,omitempty"`
	Active             bool    `json:"active"`
	TargetAccessLevels []int64 `json:"target_access_levels,omitempty"`
	TargetPath         string  `json:"target_path,omitempty"`
	BroadcastType      string  `json:"broadcast_type,omitempty"`
	Dismissable        bool    `json:"dismissable"`
	Theme              string  `json:"theme,omitempty"`
}

MessageItem represents a broadcast message in output.

type UpdateInput

type UpdateInput struct {
	ID                 int64   `json:"id" jsonschema:"Broadcast message ID,required"`
	Message            string  `json:"message,omitempty" jsonschema:"Message text. Supports Markdown."`
	StartsAt           string  `json:"starts_at,omitempty" jsonschema:"Start time in ISO 8601 format"`
	EndsAt             string  `json:"ends_at,omitempty" jsonschema:"End time in ISO 8601 format"`
	Font               string  `json:"font,omitempty" jsonschema:"Font for the message"`
	TargetAccessLevels []int64 `json:"target_access_levels,omitempty" jsonschema:"Access levels to target"`
	TargetPath         string  `json:"target_path,omitempty" jsonschema:"Target path to show message on"`
	BroadcastType      string  `json:"broadcast_type,omitempty" jsonschema:"Type: banner or notification"`
	Dismissable        *bool   `json:"dismissable,omitempty" jsonschema:"Whether message can be dismissed"`
	Theme              string  `json:"theme,omitempty" jsonschema:"Theme color"`
}

UpdateInput is the input for updating a broadcast message.

type UpdateOutput

type UpdateOutput struct {
	toolutil.HintableOutput
	Message MessageItem `json:"message"`
}

UpdateOutput contains the updated broadcast message.

func Update

func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (UpdateOutput, error)

Update modifies a broadcast message (admin-only).

Jump to

Keyboard shortcuts

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