release

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Overview

Package release provides MCP tools for managing Forgejo releases and their attachments.

It includes tools for listing, creating, editing, and deleting releases, as well as managing release attachments (listing, creating, editing, and deleting).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateReleaseAttachmentImpl

type CreateReleaseAttachmentImpl struct {
	Client *tools.Client
}

CreateReleaseAttachmentImpl implements the MCP tool for adding an attachment to a release. This is a non-idempotent operation that uploads a file from the local filesystem to the specified release using the Forgejo SDK.

func (CreateReleaseAttachmentImpl) Definition

func (CreateReleaseAttachmentImpl) Definition() *mcp.Tool

Definition describes the `create_release_attachment` tool. It requires `release_id` and a local `file_path`. It is not idempotent, as multiple calls will upload multiple files.

func (CreateReleaseAttachmentImpl) Handler

Handler implements the logic for creating a release attachment. It reads the file from the specified `file_path`, then calls the Forgejo SDK's `CreateReleaseAttachment` function to upload it. It will return an error if the file cannot be read.

type CreateReleaseAttachmentParams

type CreateReleaseAttachmentParams 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"`
	// ReleaseID is the unique identifier of the release to attach the file to.
	ReleaseID int `json:"release_id"`
	// FilePath is the local path to the file to be uploaded as an attachment.
	FilePath string `json:"file_path"`
	// Name is an optional display name for the attachment.
	Name string `json:"name,omitempty"`
}

CreateReleaseAttachmentParams defines the parameters for creating a release attachment. It specifies the release and the local file path of the asset to upload.

type CreateReleaseImpl

type CreateReleaseImpl struct {
	Client *tools.Client
}

CreateReleaseImpl implements the MCP tool for creating a new release. This is a non-idempotent operation that creates a new git tag and a corresponding release object via the Forgejo SDK.

func (CreateReleaseImpl) Definition

func (CreateReleaseImpl) Definition() *mcp.Tool

Definition describes the `create_release` tool. It requires `owner`, `repo`, `tag_name`, and a `name`. It is not idempotent, as multiple calls will fail once the tag is created.

func (CreateReleaseImpl) Handler

Handler implements the logic for creating a release. It calls the Forgejo SDK's `CreateRelease` function. On success, it returns details of the new release.

type CreateReleaseParams

type CreateReleaseParams 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"`
	// TagName is the name of the git tag for the release.
	TagName string `json:"tag_name"`
	// TargetCommitish is the branch or commit SHA to create the release from.
	TargetCommitish string `json:"target_commitish,omitempty"`
	// Name is the title of the release.
	Name string `json:"name"`
	// Body is the markdown description of the release.
	Body string `json:"body,omitempty"`
	// Draft indicates whether the release is a draft.
	Draft bool `json:"draft,omitempty"`
	// Prerelease indicates whether the release is a pre-release.
	Prerelease bool `json:"prerelease,omitempty"`
}

CreateReleaseParams defines the parameters for the create_release tool. It includes all necessary details for creating a new release.

type DeleteReleaseAttachmentImpl

type DeleteReleaseAttachmentImpl struct {
	Client *tools.Client
}

DeleteReleaseAttachmentImpl implements the destructive MCP tool for deleting a release attachment. This is an idempotent but irreversible operation that removes an attachment from a release using the Forgejo SDK.

func (DeleteReleaseAttachmentImpl) Definition

func (DeleteReleaseAttachmentImpl) Definition() *mcp.Tool

Definition describes the `delete_release_attachment` tool. It requires `release_id` and `attachment_id`. It is marked as a destructive operation to ensure clients can warn the user before execution.

func (DeleteReleaseAttachmentImpl) Handler

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

type DeleteReleaseAttachmentParams

type DeleteReleaseAttachmentParams 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"`
	// ReleaseID is the unique identifier of the release containing the attachment.
	ReleaseID int `json:"release_id"`
	// AttachmentID is the unique identifier of the attachment to delete.
	AttachmentID int `json:"attachment_id"`
}

DeleteReleaseAttachmentParams defines the parameters for deleting a release attachment. It specifies the attachment to be deleted by its ID.

type DeleteReleaseImpl

type DeleteReleaseImpl struct {
	Client *tools.Client
}

DeleteReleaseImpl implements the destructive MCP tool for deleting a release. This is an idempotent but irreversible operation that removes both the release object and its associated git tag. It uses the Forgejo SDK.

func (DeleteReleaseImpl) Definition

func (DeleteReleaseImpl) Definition() *mcp.Tool

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

func (DeleteReleaseImpl) Handler

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

type DeleteReleaseParams

type DeleteReleaseParams 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 release to delete.
	ID int `json:"id"`
}

DeleteReleaseParams defines the parameters for the delete_release tool. It specifies the release to be deleted by its ID.

type EditReleaseAttachmentImpl

type EditReleaseAttachmentImpl struct {
	Client *tools.Client
}

EditReleaseAttachmentImpl implements the MCP tool for editing a release attachment. This is an idempotent operation that renames an existing attachment using the Forgejo SDK.

func (EditReleaseAttachmentImpl) Definition

func (EditReleaseAttachmentImpl) Definition() *mcp.Tool

Definition describes the `edit_release_attachment` tool. It requires `release_id`, `attachment_id`, and a new `name`. It is marked as idempotent.

func (EditReleaseAttachmentImpl) Handler

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

type EditReleaseAttachmentParams

type EditReleaseAttachmentParams 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"`
	// ReleaseID is the unique identifier of the release containing the attachment.
	ReleaseID int `json:"release_id"`
	// AttachmentID is the unique identifier of the attachment to edit.
	AttachmentID int `json:"attachment_id"`
	// Name is the new display name for the attachment.
	Name string `json:"name"`
}

EditReleaseAttachmentParams defines the parameters for editing a release attachment. It specifies the attachment to edit and its new name.

type EditReleaseImpl

type EditReleaseImpl struct {
	Client *tools.Client
}

EditReleaseImpl implements the MCP tool for editing an existing release. This is an idempotent operation that modifies the metadata of a release identified by its ID, using the Forgejo SDK.

func (EditReleaseImpl) Definition

func (EditReleaseImpl) Definition() *mcp.Tool

Definition describes the `edit_release` tool. It requires `owner`, `repo`, and the release `id`. It is marked as idempotent, as multiple identical calls will result in the same state.

func (EditReleaseImpl) Handler

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

type EditReleaseParams

type EditReleaseParams 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 release to edit.
	ID int `json:"id"`
	// TagName is the new git tag name for the release.
	TagName string `json:"tag_name,omitempty"`
	// TargetCommitish is the new target branch or commit SHA.
	TargetCommitish string `json:"target_commitish,omitempty"`
	// Name is the new title for the release.
	Name string `json:"name,omitempty"`
	// Body is the new markdown description for the release.
	Body string `json:"body,omitempty"`
	// Draft indicates whether the release should be marked as a draft.
	Draft bool `json:"draft,omitempty"`
	// Prerelease indicates whether the release should be marked as a pre-release.
	Prerelease bool `json:"prerelease,omitempty"`
}

EditReleaseParams defines the parameters for the edit_release tool. It specifies the release to edit by ID and the fields to update.

type ListReleaseAttachmentsImpl

type ListReleaseAttachmentsImpl struct {
	Client *tools.Client
}

ListReleaseAttachmentsImpl implements the read-only MCP tool for listing release attachments. This is a safe, idempotent operation that uses the Forgejo SDK to fetch a list of all attachments for a specific release.

func (ListReleaseAttachmentsImpl) Definition

func (ListReleaseAttachmentsImpl) Definition() *mcp.Tool

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

func (ListReleaseAttachmentsImpl) Handler

Handler implements the logic for listing release attachments. It calls the Forgejo SDK's `ListReleaseAttachments` function and formats the results into a markdown list.

type ListReleaseAttachmentsParams

type ListReleaseAttachmentsParams 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"`
	// ReleaseID is the unique identifier of the release.
	ReleaseID int `json:"release_id"`
}

ListReleaseAttachmentsParams defines the parameters for the list_release_attachments tool. It specifies the release to list attachments from.

type ListReleasesImpl

type ListReleasesImpl struct {
	Client *tools.Client
}

ListReleasesImpl implements the read-only MCP tool for listing repository releases. This is a safe, idempotent operation that uses the Forgejo SDK to fetch a paginated list of releases.

func (ListReleasesImpl) Definition

func (ListReleasesImpl) Definition() *mcp.Tool

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

func (ListReleasesImpl) Handler

Handler implements the logic for listing releases. It calls the Forgejo SDK's `ListReleases` function and formats the results into a markdown list.

type ListReleasesParams

type ListReleasesParams 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"`
	// Page is the page number for pagination.
	Page int `json:"page,omitempty"`
	// Limit is the number of releases to return per page.
	Limit int `json:"limit,omitempty"`
}

ListReleasesParams defines the parameters for the list_releases tool. It specifies the owner and repository, with optional pagination.

Jump to

Keyboard shortcuts

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