mrnotes

package
v1.0.5 Latest Latest
Warning

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

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

Documentation

Overview

Package mrnotes provides MCP tool handlers for GitLab merge request note operations: create, list, update, and delete.

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 note from a merge request. Returns an error if the note does not exist or the user lacks permission.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a list of MR notes as a Markdown table.

func FormatOutputMarkdown

func FormatOutputMarkdown(n Output) string

FormatOutputMarkdown renders a single MR note as a Markdown summary.

func RegisterTools

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

RegisterTools registers all merge request note tools on the MCP server.

Types

type CreateInput

type CreateInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID     int64                `json:"mr_iid"     jsonschema:"Merge request IID (project-scoped, not 'merge_request_id'),required"`
	Body      string               `json:"body"       jsonschema:"Comment body (Markdown supported),required"`
}

CreateInput defines parameters for adding a general comment to a merge request.

type DeleteInput

type DeleteInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID     int64                `json:"mr_iid"     jsonschema:"Merge request IID (project-scoped, not 'merge_request_id'),required"`
	NoteID    int64                `json:"note_id"    jsonschema:"ID of the note to delete,required"`
}

DeleteInput defines parameters for deleting a note.

type GetInput

type GetInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID     int64                `json:"mr_iid"     jsonschema:"Merge request IID (project-scoped, not 'merge_request_id'),required"`
	NoteID    int64                `json:"note_id"    jsonschema:"ID of the note to retrieve,required"`
}

GetInput defines parameters for getting a single note.

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id"     jsonschema:"Project ID or URL-encoded path,required"`
	MRIID     int64                `json:"mr_iid"         jsonschema:"Merge request IID (project-scoped, not 'merge_request_id'),required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Order by field (created_at, updated_at)"`
	Sort      string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
}

ListInput defines parameters for listing merge request notes.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	Notes      []Output                  `json:"notes"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListOutput holds a list of notes.

func List

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

List returns a paginated list of notes for a merge request. Results can be ordered by creation or update time and sorted in ascending or descending direction.

type Output

type Output struct {
	toolutil.HintableOutput
	ID           int64  `json:"id"`
	Body         string `json:"body"`
	Author       string `json:"author"`
	CreatedAt    string `json:"created_at"`
	UpdatedAt    string `json:"updated_at"`
	System       bool   `json:"system"`
	Resolvable   bool   `json:"resolvable,omitempty"`
	Resolved     bool   `json:"resolved,omitempty"`
	ResolvedBy   string `json:"resolved_by,omitempty"`
	Internal     bool   `json:"internal,omitempty"`
	NoteableType string `json:"notable_type,omitempty"`
	NoteableID   int64  `json:"notable_id,omitempty"`
	NoteableIID  int64  `json:"notable_iid,omitempty"`
	CommitID     string `json:"commit_id,omitempty"`
	Type         string `json:"type,omitempty"`
	ProjectID    int64  `json:"project_id,omitempty"`
	Confidential bool   `json:"confidential"`
	ResolvedAt   string `json:"resolved_at,omitempty"`
	Attachment   string `json:"attachment,omitempty"`
	FileName     string `json:"file_name,omitempty"`
	ExpiresAt    string `json:"expires_at,omitempty"`
}

Output represents a note (comment) on a merge request.

func Create

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

Create adds a new general comment to a merge request. The body is normalized before submission. Returns the created note.

func GetNote

func GetNote(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)

GetNote retrieves a single note from a merge request by note ID.

func ToOutput

func ToOutput(n *gl.Note) Output

ToOutput converts a GitLab API gl.Note to an Output, formatting creation and update timestamps as RFC 3339.

func Update

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

Update modifies the body of an existing note on a merge request. Returns the updated note with refreshed timestamps.

type UpdateInput

type UpdateInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID     int64                `json:"mr_iid"     jsonschema:"Merge request IID (project-scoped, not 'merge_request_id'),required"`
	NoteID    int64                `json:"note_id"    jsonschema:"ID of the note to update,required"`
	Body      string               `json:"body"       jsonschema:"Updated comment body,required"`
}

UpdateInput defines parameters for editing a note.

Jump to

Keyboard shortcuts

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