label

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package label provides MCP tools for managing Forgejo labels.

It includes tools for listing, creating, editing, and deleting labels within a repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateLabelImpl

type CreateLabelImpl struct {
	Client *tools.Client
}

CreateLabelImpl implements the MCP tool for creating a new repository label. This is a non-idempotent operation that creates a new label using the Forgejo SDK.

func (CreateLabelImpl) Definition

func (CreateLabelImpl) Definition() *mcp.Tool

Definition describes the `create_label` tool. It requires `owner`, `repo`, a `name`, and a `color`. It is not idempotent, as multiple calls with the same name will fail once the first label is created.

func (CreateLabelImpl) Handler

Handler implements the logic for creating a label. It calls the Forgejo SDK's `CreateLabel` function and returns the details of the newly created label.

type CreateLabelParams

type CreateLabelParams struct {
	// Owner is the username or organization name that owns the repository.
	Owner string `json:"owner"`
	// Repo is the name of the repository.
	Repo string `json:"repo"`
	// Name is the name of the new label.
	Name string `json:"name"`
	// Color is the hex color code for the label (without the '#').
	Color string `json:"color"`
	// Description is the optional markdown description of the label.
	Description string `json:"description,omitempty"`
}

CreateLabelParams defines the parameters for the create_label tool. It includes the label's name, color, and optional description.

type DeleteLabelImpl

type DeleteLabelImpl struct {
	Client *tools.Client
}

DeleteLabelImpl implements the destructive MCP tool for deleting a repository label. This is an idempotent but irreversible operation that removes a label from a repository using the Forgejo SDK.

func (DeleteLabelImpl) Definition

func (DeleteLabelImpl) Definition() *mcp.Tool

Definition describes the `delete_label` tool. It requires `owner`, `repo`, and the label `id`. It is marked as a destructive operation to ensure clients can warn the user before execution.

func (DeleteLabelImpl) Handler

Handler implements the logic for deleting a label. It calls the Forgejo SDK's `DeleteLabel` function. On success, it returns a simple text confirmation. It will return an error if the label does not exist.

type DeleteLabelParams

type DeleteLabelParams struct {
	// Owner is the username or organization name that owns the repository.
	Owner string `json:"owner"`
	// Repo is the name of the repository.
	Repo string `json:"repo"`
	// ID is the unique identifier of the label to delete.
	ID int `json:"id"`
}

DeleteLabelParams defines the parameters for the delete_label tool. It specifies the label to be deleted by its ID.

type EditLabelImpl

type EditLabelImpl struct {
	Client *tools.Client
}

EditLabelImpl implements the MCP tool for editing an existing repository label. This is an idempotent operation that modifies a label's metadata using the Forgejo SDK.

func (EditLabelImpl) Definition

func (EditLabelImpl) Definition() *mcp.Tool

Definition describes the `edit_label` tool. It requires `owner`, `repo`, and the label `id`. It is marked as idempotent.

func (EditLabelImpl) Handler

Handler implements the logic for editing a label. It calls the Forgejo SDK's `EditLabel` function. It will return an error if the label ID is not found.

type EditLabelParams

type EditLabelParams struct {
	// Owner is the username or organization name that owns the repository.
	Owner string `json:"owner"`
	// Repo is the name of the repository.
	Repo string `json:"repo"`
	// ID is the unique identifier of the label to edit.
	ID int `json:"id"`
	// Name is the new name for the label.
	Name string `json:"name,omitempty"`
	// Color is the new hex color code for the label (without the '#').
	Color string `json:"color,omitempty"`
	// Description is the new optional markdown description for the label.
	Description string `json:"description,omitempty"`
}

EditLabelParams defines the parameters for the edit_label tool. It specifies the label to edit by ID and the fields to update.

type ListRepoLabelsImpl

type ListRepoLabelsImpl struct {
	Client *tools.Client
}

ListRepoLabelsImpl implements the read-only MCP tool for listing repository labels. This operation is safe, idempotent, and does not modify any data. It fetches all available labels for a specified repository using the Forgejo SDK.

func (ListRepoLabelsImpl) Definition

func (ListRepoLabelsImpl) Definition() *mcp.Tool

Definition describes the `list_repo_labels` tool. It requires `owner` and `repo` as parameters and is marked as a safe, read-only operation.

func (ListRepoLabelsImpl) Handler

Handler implements the logic for listing labels. It calls the Forgejo SDK's `ListRepoLabels` function and formats the resulting slice of labels into a markdown list. Errors will occur if the repository is not found or authentication fails.

type ListRepoLabelsParams

type ListRepoLabelsParams struct {
	// Owner is the username or organization name that owns the repository.
	Owner string `json:"owner"`
	// Repo is the name of the repository.
	Repo string `json:"repo"`
}

ListRepoLabelsParams defines the parameters for the list_repo_labels tool. It specifies the owner and repository name to list labels from.

Jump to

Keyboard shortcuts

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