代码拉取完成,页面将自动刷新
package repository
import (
"context"
"fmt"
"gitee.com/oschina/mcp-gitee/operations/types"
"gitee.com/oschina/mcp-gitee/utils"
"github.com/mark3labs/mcp-go/mcp"
)
const (
CreateReleaseToolName = "create_release"
)
var CreateReleaseTool = mcp.NewTool(
CreateReleaseToolName,
mcp.WithDescription("Create a release"),
mcp.WithString(
"owner",
mcp.Description("The space address to which the repository belongs (the address path of the enterprise, organization or individual)"),
mcp.Required(),
),
mcp.WithString(
"repo",
mcp.Description("The path of the repository"),
mcp.Required(),
),
mcp.WithString(
"tag_name",
mcp.Description("The name of the tag"),
mcp.Required(),
),
mcp.WithString(
"name",
mcp.Description("The name of the release"),
mcp.Required(),
),
mcp.WithString(
"body",
mcp.Description("The description of the release"),
mcp.Required(),
),
mcp.WithBoolean(
"prerelease",
mcp.Description("Whether the release is a prerelease"),
mcp.DefaultBool(false),
),
mcp.WithString(
"target_commitish",
mcp.Description("The branch name or commit SHA, defaults to the repository's default branch"),
mcp.Required(),
),
)
func CreateReleaseHandleFunc(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
args, _ := utils.ConvertArgumentsToMap(request.Params.Arguments)
if checkResult, err := utils.CheckRequired(args, "owner", "repo"); err != nil {
return checkResult, err
}
owner := args["owner"].(string)
repo := args["repo"].(string)
apiUrl := fmt.Sprintf("/repos/%s/%s/releases", owner, repo)
giteeClient := utils.NewGiteeClient("POST", apiUrl, utils.WithContext(ctx), utils.WithPayload(args))
release := &types.Release{}
return giteeClient.HandleMCPResult(release)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。