mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-08-23 22:33:05 +00:00
add some new tools and adjust format
This commit is contained in:
@@ -19,48 +19,33 @@ const (
|
||||
var (
|
||||
CreateRepoTool = mcp.NewTool(
|
||||
CreateRepoToolName,
|
||||
CreateRepoOpt...,
|
||||
)
|
||||
|
||||
CreateRepoOpt = []mcp.ToolOption{
|
||||
mcp.WithDescription("Create repository"),
|
||||
mcp.WithString("name", mcp.Required(), mcp.DefaultString("test"), mcp.Description("Name of the repository to create")),
|
||||
mcp.WithString("description", mcp.DefaultString(""), mcp.Description("Description of the repository to create")),
|
||||
mcp.WithBoolean("private", mcp.DefaultBool(true), mcp.Description("Whether the repository is private")),
|
||||
mcp.WithString("issue_labels", mcp.DefaultString(""), mcp.Description("Issue Label set to use")),
|
||||
mcp.WithBoolean("auto_init", mcp.DefaultBool(false), mcp.Description("Whether the repository should be auto-intialized?")),
|
||||
mcp.WithBoolean("template", mcp.DefaultBool(false), mcp.Description("Whether the repository is template")),
|
||||
mcp.WithString("gitignores", mcp.DefaultString(""), mcp.Description("Gitignores to use")),
|
||||
mcp.WithString("license", mcp.DefaultString("MIT"), mcp.Description("License to use")),
|
||||
mcp.WithString("readme", mcp.DefaultString(""), mcp.Description("Readme of the repository to create")),
|
||||
mcp.WithString("default_branch", mcp.DefaultString("main"), mcp.Description("DefaultBranch of the repository (used when initializes and in template)")),
|
||||
}
|
||||
mcp.WithString("name", mcp.Required(), mcp.Description("Name of the repository to create"), mcp.DefaultString("test")),
|
||||
mcp.WithString("description", mcp.Description("Description of the repository to create"), mcp.DefaultString("")),
|
||||
mcp.WithBoolean("private", mcp.Description("Whether the repository is private"), mcp.DefaultBool(true)),
|
||||
mcp.WithString("issue_labels", mcp.Description("Issue Label set to use"), mcp.DefaultString("")),
|
||||
mcp.WithBoolean("auto_init", mcp.Description("Whether the repository should be auto-intialized?"), mcp.DefaultBool(false)),
|
||||
mcp.WithBoolean("template", mcp.Description("Whether the repository is template"), mcp.DefaultBool(false)),
|
||||
mcp.WithString("gitignores", mcp.Description("Gitignores to use"), mcp.DefaultString("")),
|
||||
mcp.WithString("license", mcp.Description("License to use"), mcp.DefaultString("MIT")),
|
||||
mcp.WithString("readme", mcp.Description("Readme of the repository to create"), mcp.DefaultString("")),
|
||||
mcp.WithString("default_branch", mcp.Description("DefaultBranch of the repository (used when initializes and in template)"), mcp.DefaultString("main")),
|
||||
)
|
||||
|
||||
ListMyReposTool = mcp.NewTool(
|
||||
ListMyReposToolName,
|
||||
ListMyReposOpt...,
|
||||
)
|
||||
|
||||
ListMyReposOpt = []mcp.ToolOption{
|
||||
mcp.WithDescription("List my repositories"),
|
||||
mcp.WithNumber(
|
||||
"page",
|
||||
mcp.Description("Page number"),
|
||||
mcp.DefaultNumber(1),
|
||||
mcp.Min(1),
|
||||
),
|
||||
mcp.WithNumber(
|
||||
"pageSize",
|
||||
mcp.Description("Page size number"),
|
||||
mcp.DefaultNumber(10),
|
||||
mcp.Min(1),
|
||||
),
|
||||
}
|
||||
mcp.WithNumber("page", mcp.Required(), mcp.Description("Page number"), mcp.DefaultNumber(1), mcp.Min(1)),
|
||||
mcp.WithNumber("pageSize", mcp.Required(), mcp.Description("Page size number"), mcp.DefaultNumber(10), mcp.Min(1)),
|
||||
)
|
||||
)
|
||||
|
||||
func RegisterTool(s *server.MCPServer) {
|
||||
s.AddTool(CreateRepoTool, CreateRepoFn)
|
||||
s.AddTool(ListMyReposTool, ListMyReposFn)
|
||||
|
||||
// Branch
|
||||
s.AddTool(CreateBranchTool, CreateBranchFn)
|
||||
}
|
||||
|
||||
func CreateRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
||||
|
Reference in New Issue
Block a user