Documentation
¶
Overview ¶
Package securitycategories implements MCP tools for GitLab security categories.
The package exposes catalog-backed actions for creating, updating, and deleting the category records that group GitLab security attributes. Handlers validate namespace and category identifiers, optional update fields, and GraphQL mutation responses before returning MCP-friendly output with nested attribute summaries.
Security categories are GraphQL-backed GitLab security taxonomy objects. This package keeps those mutations and conversions together so meta-tools, dynamic discovery, individual tool projection, and Markdown rendering all describe the same behavior.
GitLab API docs:
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 security category actions.
func FormatDeleteOutputMarkdown ¶ added in v3.1.0
func FormatDeleteOutputMarkdown(out DeleteOutput) string
FormatDeleteOutputMarkdown renders a deleted security category: the confirmation, and the attributes GitLab deleted with it, which a caller holding one of their IDs needs to know no longer exist.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders a security category as the card of one object: its identity, whether a project may carry several of its attributes at once, how much of it GitLab allows changing, and its attributes as a collection.
Types ¶
type AttributeSummary ¶
type AttributeSummary struct {
ID int64 `json:"id"`
Name string `json:"name"`
Color string `json:"color"`
Description string `json:"description,omitempty"`
EditableState string `json:"editable_state,omitempty"`
}
AttributeSummary represents a security attribute nested in a category response.
type CreateInput ¶
type CreateInput struct {
NamespaceID int64 `json:"namespace_id" jsonschema:"Numeric namespace ID,required"`
Name string `json:"name" jsonschema:"Security category name,required"`
Description *string `json:"description,omitempty" jsonschema:"Security category description"`
MultipleSelection *bool `json:"multiple_selection,omitempty" jsonschema:"Whether multiple attributes can be selected for the category"`
}
CreateInput defines parameters for creating a security category.
type DeleteInput ¶
type DeleteInput struct {
CategoryID int64 `json:"category_id" jsonschema:"Numeric security category ID,required"`
}
DeleteInput defines parameters for deleting a security category.
type DeleteOutput ¶ added in v3.1.0
type DeleteOutput struct {
toolutil.HintableOutput
Status string `json:"status"`
Message string `json:"message"`
DeletedAttributeIDs []int64 `json:"deleted_attribute_ids"`
}
DeleteOutput confirms a deleted security category and names the security attributes GitLab deleted with it: a category takes its attributes along, so an attribute ID the caller still holds may no longer exist.
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) (DeleteOutput, error)
Delete deletes a GitLab security category and its associated attributes, and reports the attributes GitLab deleted with it.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
MultipleSelection bool `json:"multiple_selection"`
EditableState string `json:"editable_state,omitempty"`
TemplateType string `json:"template_type,omitempty"`
SecurityAttributes []AttributeSummary `json:"security_attributes,omitempty"`
}
Output represents a GitLab security category.
func Create ¶
func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
Create creates a GitLab security category.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
Update updates a GitLab security category.
type UpdateInput ¶
type UpdateInput struct {
CategoryID int64 `json:"category_id" jsonschema:"Numeric security category ID,required"`
NamespaceID int64 `json:"namespace_id" jsonschema:"Numeric namespace ID,required"`
Name *string `json:"name,omitempty" jsonschema:"New security category name"`
Description *string `json:"description,omitempty" jsonschema:"New security category description"`
}
UpdateInput defines parameters for updating a security category.