pullreq

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pullreq provides MCP tools for interacting with Forgejo pull requests.

It includes tools for listing, retrieving, and creating pull requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePullRequestImpl added in v0.0.7

type CreatePullRequestImpl struct {
	Client *tools.Client
}

CreatePullRequestImpl implements the MCP tool for creating a new pull request. This is a non-idempotent operation that opens a new pull request via the Forgejo SDK.

func (CreatePullRequestImpl) Definition added in v0.0.7

func (CreatePullRequestImpl) Definition() *mcp.Tool

Definition describes the `create_pull_request` tool. It requires `owner`, `repo`, `head`, `base`, and a `title`. Repeated calls will create multiple pull requests.

func (CreatePullRequestImpl) Handler added in v0.0.7

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

type CreatePullRequestParams added in v0.0.7

type CreatePullRequestParams 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"`
	// Head identifies the source branch (optionally `owner:branch`) to merge from.
	Head string `json:"head"`
	// Base identifies the target branch to merge into.
	Base string `json:"base"`
	// Title is the pull request title.
	Title string `json:"title"`
	// Body is the pull request description in Markdown.
	Body string `json:"body,omitempty"`
	// Assignee assigns the pull request to a single user.
	Assignee string `json:"assignee,omitempty"`
	// Assignees assigns multiple users to the pull request.
	Assignees []string `json:"assignees,omitempty"`
	// Milestone is the milestone ID associated with the pull request.
	Milestone int `json:"milestone,omitempty"`
	// Labels is a slice of label IDs to attach to the pull request.
	Labels []int `json:"labels,omitempty"`
	// DueDate is the optional deadline for the pull request.
	DueDate time.Time `json:"due_date"`
}

CreatePullRequestParams defines the parameters for the create_pull_request tool. It captures the branches, title, description, and optional metadata for the new pull request.

type GetPullRequestImpl

type GetPullRequestImpl struct {
	Client *tools.Client
}

GetPullRequestImpl implements the read-only MCP tool for fetching a single pull request. This is a safe, idempotent operation that uses the Forgejo SDK to retrieve detailed information about a specific pull request.

func (GetPullRequestImpl) Definition

func (GetPullRequestImpl) Definition() *mcp.Tool

Definition describes the `get_pull_request` tool. It requires `owner`, `repo`, and the pull request `index`. It is marked as a safe, read-only operation.

func (GetPullRequestImpl) Handler

Handler implements the logic for fetching a pull request. It calls the Forgejo SDK's `GetPullRequest` function and formats the result into a detailed markdown view. It will return an error if the pull request is not found.

type GetPullRequestParams

type GetPullRequestParams 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"`
	// Index is the pull request number.
	Index int `json:"index"`
}

GetPullRequestParams defines the parameters for the get_pull_request tool. It specifies the pull request to retrieve by its owner, repository, and index.

type ListPullRequestsImpl

type ListPullRequestsImpl struct {
	Client *tools.Client
}

ListPullRequestsImpl implements the read-only MCP tool for listing pull requests. This is a safe, idempotent operation that uses the Forgejo SDK to fetch a list of pull requests with powerful filtering and sorting capabilities.

func (ListPullRequestsImpl) Definition

func (ListPullRequestsImpl) Definition() *mcp.Tool

Definition describes the `list_pull_requests` tool. It requires `owner` and `repo` and supports a rich set of optional parameters for filtering and sorting. It is marked as a safe, read-only operation.

func (ListPullRequestsImpl) Handler

Handler implements the logic for listing pull requests. It calls the Forgejo SDK's `ListRepoPullRequests` function with the provided filters and formats the results into a markdown table.

type ListPullRequestsParams

type ListPullRequestsParams 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"`
	// State filters pull requests by their state (e.g., 'open', 'closed').
	State string `json:"state,omitempty"`
	// Sort specifies the sort order for the results.
	Sort string `json:"sort,omitempty"`
	// Direction specifies the sort direction (asc or desc).
	Direction string `json:"direction,omitempty"`
	// Milestone filters pull requests by a milestone title.
	Milestone string `json:"milestone,omitempty"`
	// Labels filters pull requests by a list of label names.
	Labels []string `json:"labels,omitempty"`
	// Page is the page number for pagination.
	Page int `json:"page,omitempty"`
	// Limit is the number of pull requests to return per page.
	Limit int `json:"limit,omitempty"`
}

ListPullRequestsParams defines the parameters for the list_pull_requests tool. It includes options for filtering, sorting, and paginating pull requests.

Jump to

Keyboard shortcuts

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