snippetnotes

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: 10 Imported by: 0

Documentation

Overview

markdown.go provides Markdown formatting functions for snippet note MCP tool output.

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

Package snippetnotes implements GitLab snippet note (comment) operations including list, get, create, update, and delete. Notes are comments attached to project snippets and may be system-generated or user-created.

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

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

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

func FormatOutputMarkdown

func FormatOutputMarkdown(n Output) string

FormatOutputMarkdown renders a single snippet note as a Markdown summary.

func RegisterTools

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

RegisterTools registers MCP tools for GitLab snippet note operations.

Types

type CreateInput

type CreateInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id"  jsonschema:"Project ID or URL-encoded path,required"`
	SnippetID int64                `json:"snippet_id"  jsonschema:"Snippet ID,required"`
	Body      string               `json:"body"        jsonschema:"Note body (Markdown supported),required"`
}

CreateInput defines parameters for creating a note on a snippet.

type DeleteInput

type DeleteInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id"  jsonschema:"Project ID or URL-encoded path,required"`
	SnippetID int64                `json:"snippet_id"  jsonschema:"Snippet ID,required"`
	NoteID    int64                `json:"note_id"     jsonschema:"ID of the note to delete,required"`
}

DeleteInput defines parameters for deleting a snippet note.

type GetInput

type GetInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id"  jsonschema:"Project ID or URL-encoded path,required"`
	SnippetID int64                `json:"snippet_id"  jsonschema:"Snippet ID,required"`
	NoteID    int64                `json:"note_id"     jsonschema:"ID of the note to retrieve,required"`
}

GetInput defines parameters for getting a single snippet note.

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	SnippetID int64                `json:"snippet_id" jsonschema:"Snippet 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 snippet notes.

type ListOutput

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

ListOutput holds a paginated list of snippet notes.

func List

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

List retrieves a paginated list of notes on a snippet.

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,omitempty"`
	System       bool   `json:"system"`
	NoteableType string `json:"notable_type,omitempty"`
	NoteableID   int64  `json:"notable_id,omitempty"`
}

Output represents a note (comment) on a snippet.

func Create

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

Create adds a new note to a snippet.

func Get

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

Get retrieves a single note on a snippet.

func Update

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

Update modifies the body of an existing snippet note.

type UpdateInput

type UpdateInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id"  jsonschema:"Project ID or URL-encoded path,required"`
	SnippetID int64                `json:"snippet_id"  jsonschema:"Snippet ID,required"`
	NoteID    int64                `json:"note_id"     jsonschema:"ID of the note to update,required"`
	Body      string               `json:"body"        jsonschema:"Updated note body (Markdown supported),required"`
}

UpdateInput defines parameters for updating a snippet note.

Jump to

Keyboard shortcuts

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