32 Star 310 Fork 86

开源中国/mcp-gitee

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
creatre_release.go 1.74 KB
一键复制 编辑 原始数据 按行查看 历史
JJ-H 提交于 2025-06-16 16:10 +08:00 . feat: Support streamable http
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)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/oschina/mcp-gitee.git
git@gitee.com:oschina/mcp-gitee.git
oschina
mcp-gitee
mcp-gitee
v0.1.14

搜索帮助