Documentation
¶
Overview ¶
Package epicnotes implements MCP tools for GitLab epic note operations.
The package wraps the GitLab Notes API for epic notes:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func DeleteOutput(ctx context.Context, client *gitlabclient.Client, input DeleteInput) (toolutil.DeleteOutput, error)
- func FormatListMarkdown(out ListOutput) string
- func FormatOutputMarkdown(n Output) string
- type CreateInput
- type DeleteInput
- type GetInput
- type ListInput
- type ListOutput
- type NoteUserOutput
- type Output
- type UpdateInput
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 epic note actions exposed as MCP tools. The list/get/create/update/delete routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004). Epic notes are a Premium/Ultimate (Edition: premium) capability served through the Work Items GraphQL API.
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete removes a note from an epic via the destroyNote GraphQL mutation, once the note is known to be one of the epic's.
func DeleteOutput ¶
func DeleteOutput(ctx context.Context, client *gitlabclient.Client, input DeleteInput) (toolutil.DeleteOutput, error)
DeleteOutput deletes an epic note and returns the canonical success message shape. The message names the address GitLab served the note at, which the note was held to before the delete, so "from epic" is a statement about the note rather than an echo of the caller's input.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) string
FormatListMarkdown renders a list of epic notes as a Markdown table. The notes widget is a keyset connection, which counts nothing it has not walked, so the heading carries the count shown and the cursor line below the rows says whether more follow. The table carries no link, so its footer carries no instruction to keep them.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders a single epic note as the shared note card: the author as a handle, the time, the system, internal and resolution markers when they hold, the body as the card's long text, and what the quick actions in the body did when a create or update reported it.
A create whose body held only quick actions has no note to show, since GitLab ran the commands and kept none, so it renders the commands alone and points at the epic they changed rather than at a note that does not exist.
Types ¶
type CreateInput ¶
type CreateInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the group (e.g. my-group),required"`
IID int64 `json:"epic_iid" jsonschema:"Epic IID within the group,required"`
Body string `json:"body" jsonschema:"Note body (Markdown supported),required"`
}
CreateInput defines parameters for creating a note on an epic.
type DeleteInput ¶
type DeleteInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the group (e.g. my-group),required"`
IID int64 `json:"epic_iid" jsonschema:"Epic IID within the group,required"`
NoteID int64 `json:"note_id" jsonschema:"ID of the note to delete,required"`
}
DeleteInput defines parameters for deleting an epic note.
type GetInput ¶
type GetInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the group (e.g. my-group),required"`
IID int64 `json:"epic_iid" jsonschema:"Epic IID within the group,required"`
NoteID int64 `json:"note_id" jsonschema:"ID of the note to retrieve,required"`
}
GetInput defines parameters for getting a single epic note.
type ListInput ¶
type ListInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the group (e.g. my-group or my-group/sub-group),required"`
IID int64 `json:"epic_iid" jsonschema:"Epic IID within the group,required"`
toolutil.GraphQLPaginationInput
}
ListInput defines parameters for listing epic notes.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Notes []Output `json:"notes"`
Pagination toolutil.GraphQLForwardPaginationOutput `json:"pagination"`
}
ListOutput holds a paginated list of epic notes.
Pagination is forward-only because the work item notes widget is: its discussions field accepts first and after alone. Being keyset-paginated it does report a previous page and a start cursor from its second page on, and that half is dropped here rather than passed on, since no argument on this tool could spend the cursor.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves notes on an epic via the Work Items GraphQL API. Notes are extracted from all discussions in the notes widget.
type NoteUserOutput ¶
type NoteUserOutput struct {
ID int64 `json:"id"`
Username string `json:"username"`
Name string `json:"name,omitempty"`
WebURL string `json:"web_url,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
}
NoteUserOutput mirrors the GraphQL User fields selected for a note author: the user who authored the note.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int64 `json:"id"`
GID string `json:"gid,omitempty"`
ResourceEvent bool `json:"resource_event,omitempty"`
Body string `json:"body"`
Author *NoteUserOutput `json:"author,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at,omitempty"`
System bool `json:"system"`
Internal bool `json:"internal"`
Imported bool `json:"imported"`
ExternalAuthor string `json:"external_author,omitempty"`
LastEditedAt string `json:"last_edited_at,omitempty"`
LastEditedBy *NoteUserOutput `json:"last_edited_by,omitempty"`
NoteableID int64 `json:"noteable_id,omitempty"`
NoteableType string `json:"noteable_type,omitempty"`
Resolvable bool `json:"resolvable,omitempty"`
Resolved bool `json:"resolved,omitempty"`
ResolvedAt string `json:"resolved_at,omitempty"`
ResolvedBy *NoteUserOutput `json:"resolved_by,omitempty"`
URL string `json:"url,omitempty"`
QuickActionsStatus *toolutil.QuickActionsStatusOutput `json:"quick_actions_status,omitempty"`
}
Output represents a note (comment) on an epic. Per the locked canonical-key convention the full *NoteUserOutput author object is surfaced on the canonical `author` key. Only fields the Work Items GraphQL notes widget actually returns are populated (no invented output scalars per the 1:1 audit policy).
The keys the REST note entity shares with GraphQL's Note carry the REST spelling (internal, imported, noteable_id, noteable_type and the resolution keys), so an epic note reads like every other note this server answers with. last_edited_by and resolved_by are the author's object carrying the id and the username alone, which is what the list query can afford to select for a hundred threads. quick_actions_status is set by create and update alone, and only when the body carried a quick action: it is GitLab's account of what the commands did. A create whose body held nothing but quick actions answers with the status and no note, id 0, since GitLab ran the commands and kept none.
gid is the note's GraphQL global ID as GitLab answered it, on every note. It is the only identifier of a note GitLab synthesizes from a resource event (a label, state, milestone, iteration or weight change), whose global ID ends in a hexadecimal discussion ID rather than a number: such a note carries id 0 and resource_event true, and no note action can address it.
func Create ¶
func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
Create adds a new note to an epic via the createNote GraphQL mutation.
func Get ¶
Get retrieves a single note on an epic by querying the notes widget and matching by note ID.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
Update modifies the body of an existing epic note via the updateNote GraphQL mutation.
type UpdateInput ¶
type UpdateInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the group (e.g. my-group),required"`
IID int64 `json:"epic_iid" jsonschema:"Epic IID within the group,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 an epic note.