mrnotes

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mrnotes implements MCP tools for GitLab merge request note operations.

The package wraps the GitLab Notes API for merge request notes:

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 merge request note actions exposed as MCP tools. The create/list/get/update/delete routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).

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.

Types

type CreateInput

type CreateInput struct {
	ProjectID               toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID                   int64                `json:"merge_request_iid"     jsonschema:"Merge request IID (project-scoped, not 'merge_request_id'),required"`
	Body                    string               `json:"body"       jsonschema:"Comment body (Markdown supported),required"`
	Internal                *bool                `json:"internal,omitempty"   jsonschema:"Mark note as internal (visible only to project members)"`
	CreatedAt               string               `` /* 192-byte string literal not displayed */
	MergeRequestDiffHeadSHA string               `` /* 172-byte string literal not displayed */
}

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:"merge_request_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:"merge_request_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:"merge_request_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
	toolutil.KeysetPaginationInput
}

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 = toolutil.NoteOutput

Output is an alias of toolutil.NoteOutput, the canonical REST note shape shared between mrnotes and issuenotes. Field layout and JSON tags are defined in toolutil; see toolutil.NoteOutputFromGitLab for the 1:1 audit conversion logic.

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 the MCP tool Output shape. Delegates to toolutil.NoteOutputFromGitLab which owns the 1:1 audit field mapping and timestamp formatting.

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:"merge_request_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