Documentation
¶
Index ¶
- Constants
- Variables
- func CreateBranchFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func CreateFileFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func CreateReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func CreateRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func CreateTagFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func DeleteBranchFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func DeleteFileFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func DeleteReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func DeleteTagFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func ForkRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func GetDirContentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func GetFileContentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func GetLatestReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func GetReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func GetTagFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func ListBranchesFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func ListMyReposFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func ListReleasesFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func ListRepoCommitsFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func ListTagsFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func RegisterTool(s *server.MCPServer)
- func UpdateFileFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- type ContentLine
- type ListReleaseResult
- type ListTagResult
Constants ¶
View Source
const ( CreateBranchToolName = "create_branch" DeleteBranchToolName = "delete_branch" ListBranchesToolName = "list_branches" )
View Source
const ( GetFileToolName = "get_file_content" GetDirToolName = "get_dir_content" CreateFileToolName = "create_file" UpdateFileToolName = "update_file" DeleteFileToolName = "delete_file" )
View Source
const ( CreateReleaseToolName = "create_release" DeleteReleaseToolName = "delete_release" GetReleaseToolName = "get_release" GetLatestReleaseToolName = "get_latest_release" ListReleasesToolName = "list_releases" )
View Source
const ( CreateRepoToolName = "create_repo" ForkRepoToolName = "fork_repo" ListMyReposToolName = "list_my_repos" )
View Source
const ( CreateTagToolName = "create_tag" DeleteTagToolName = "delete_tag" GetTagToolName = "get_tag" ListTagsToolName = "list_tags" )
View Source
const (
ListRepoCommitsToolName = "list_repo_commits"
)
Variables ¶
View Source
var ( CreateBranchTool = mcp.NewTool( CreateBranchToolName, mcp.WithDescription("Create branch"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("branch", mcp.Required(), mcp.Description("Name of the branch to create")), mcp.WithString("old_branch", mcp.Required(), mcp.Description("Name of the old branch to create from")), ) DeleteBranchTool = mcp.NewTool( DeleteBranchToolName, mcp.WithDescription("Delete branch"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("branch", mcp.Required(), mcp.Description("Name of the branch to delete")), ) ListBranchesTool = mcp.NewTool( ListBranchesToolName, mcp.WithDescription("List branches"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), ) )
View Source
var ( GetFileContentTool = mcp.NewTool( GetFileToolName, mcp.WithDescription("Get file Content and Metadata"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("ref", mcp.Required(), mcp.Description("ref can be branch/tag/commit")), mcp.WithString("filePath", mcp.Required(), mcp.Description("file path")), mcp.WithBoolean("withLines", mcp.Description("whether to return file content with lines")), ) GetDirContentTool = mcp.NewTool( GetDirToolName, mcp.WithDescription("Get a list of entries in a directory"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("ref", mcp.Required(), mcp.Description("ref can be branch/tag/commit")), mcp.WithString("filePath", mcp.Required(), mcp.Description("directory path")), ) CreateFileTool = mcp.NewTool( CreateFileToolName, mcp.WithDescription("Create file"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("filePath", mcp.Required(), mcp.Description("file path")), mcp.WithString("content", mcp.Required(), mcp.Description("file content")), mcp.WithString("message", mcp.Required(), mcp.Description("commit message")), mcp.WithString("branch_name", mcp.Required(), mcp.Description("branch name")), mcp.WithString("new_branch_name", mcp.Description("new branch name")), ) UpdateFileTool = mcp.NewTool( UpdateFileToolName, mcp.WithDescription("Update file"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("filePath", mcp.Required(), mcp.Description("file path")), mcp.WithString("sha", mcp.Required(), mcp.Description("sha is the SHA for the file that already exists")), mcp.WithString("content", mcp.Required(), mcp.Description("file content")), mcp.WithString("message", mcp.Required(), mcp.Description("commit message")), mcp.WithString("branch_name", mcp.Required(), mcp.Description("branch name")), ) DeleteFileTool = mcp.NewTool( DeleteFileToolName, mcp.WithDescription("Delete file"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("filePath", mcp.Required(), mcp.Description("file path")), mcp.WithString("message", mcp.Required(), mcp.Description("commit message")), mcp.WithString("branch_name", mcp.Required(), mcp.Description("branch name")), mcp.WithString("sha", mcp.Description("sha")), ) )
View Source
var ( CreateReleaseTool = mcp.NewTool( CreateReleaseToolName, mcp.WithDescription("Create release"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("tag_name", mcp.Required(), mcp.Description("tag name")), mcp.WithString("target", mcp.Required(), mcp.Description("target commitish")), mcp.WithString("title", mcp.Required(), mcp.Description("release title")), mcp.WithBoolean("is_draft", mcp.Description("Whether the release is draft"), mcp.DefaultBool(false)), mcp.WithBoolean("is_pre_release", mcp.Description("Whether the release is pre-release"), mcp.DefaultBool(false)), mcp.WithString("body", mcp.Description("release body")), ) DeleteReleaseTool = mcp.NewTool( DeleteReleaseToolName, mcp.WithDescription("Delete release"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithNumber("id", mcp.Required(), mcp.Description("release id")), ) GetReleaseTool = mcp.NewTool( GetReleaseToolName, mcp.WithDescription("Get release"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithNumber("id", mcp.Required(), mcp.Description("release id")), ) GetLatestReleaseTool = mcp.NewTool( GetLatestReleaseToolName, mcp.WithDescription("Get latest release"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), ) ListReleasesTool = mcp.NewTool( ListReleasesToolName, mcp.WithDescription("List releases"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithBoolean("is_draft", mcp.Description("Whether the release is draft"), mcp.DefaultBool(false)), mcp.WithBoolean("is_pre_release", mcp.Description("Whether the release is pre-release"), mcp.DefaultBool(false)), mcp.WithNumber("page", mcp.Description("page number"), mcp.DefaultNumber(1), mcp.Min(1)), mcp.WithNumber("pageSize", mcp.Description("page size"), mcp.DefaultNumber(20), mcp.Min(1)), ) )
View Source
var ( CreateRepoTool = mcp.NewTool( CreateRepoToolName, mcp.WithDescription("Create repository in personal account or organization"), mcp.WithString("name", mcp.Required(), mcp.Description("Name of the repository to create")), mcp.WithString("description", mcp.Description("Description of the repository to create")), mcp.WithBoolean("private", mcp.Description("Whether the repository is private")), mcp.WithString("issue_labels", mcp.Description("Issue Label set to use")), mcp.WithBoolean("auto_init", mcp.Description("Whether the repository should be auto-intialized?")), mcp.WithBoolean("template", mcp.Description("Whether the repository is template")), mcp.WithString("gitignores", mcp.Description("Gitignores to use")), mcp.WithString("license", mcp.Description("License to use")), mcp.WithString("readme", mcp.Description("Readme of the repository to create")), mcp.WithString("default_branch", mcp.Description("DefaultBranch of the repository (used when initializes and in template)")), mcp.WithString("organization", mcp.Description("Organization name to create repository in (optional - defaults to personal account)")), ) ForkRepoTool = mcp.NewTool( ForkRepoToolName, mcp.WithDescription("Fork repository"), mcp.WithString("user", mcp.Required(), mcp.Description("User name of the repository to fork")), mcp.WithString("repo", mcp.Required(), mcp.Description("Repository name to fork")), mcp.WithString("organization", mcp.Description("Organization name to fork")), mcp.WithString("name", mcp.Description("Name of the forked repository")), ) ListMyReposTool = mcp.NewTool( ListMyReposToolName, mcp.WithDescription("List my repositories"), 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(100), mcp.Min(1)), ) )
View Source
var ( CreateTagTool = mcp.NewTool( CreateTagToolName, mcp.WithDescription("Create tag"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("tag_name", mcp.Required(), mcp.Description("tag name")), mcp.WithString("target", mcp.Description("target commitish"), mcp.DefaultString("")), mcp.WithString("message", mcp.Description("tag message"), mcp.DefaultString("")), ) DeleteTagTool = mcp.NewTool( DeleteTagToolName, mcp.WithDescription("Delete tag"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("tag_name", mcp.Required(), mcp.Description("tag name")), ) GetTagTool = mcp.NewTool( GetTagToolName, mcp.WithDescription("Get tag"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("tag_name", mcp.Required(), mcp.Description("tag name")), ) ListTagsTool = mcp.NewTool( ListTagsToolName, mcp.WithDescription("List tags"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithNumber("page", mcp.Description("page number"), mcp.DefaultNumber(1), mcp.Min(1)), mcp.WithNumber("pageSize", mcp.Description("page size"), mcp.DefaultNumber(20), mcp.Min(1)), ) )
View Source
var ListRepoCommitsTool = mcp.NewTool( ListRepoCommitsToolName, mcp.WithDescription("List repository commits"), mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")), mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")), mcp.WithString("sha", mcp.Description("SHA or branch to start listing commits from")), mcp.WithString("path", mcp.Description("path indicates that only commits that include the path's file/dir should be returned.")), mcp.WithNumber("page", mcp.Required(), mcp.Description("page number"), mcp.DefaultNumber(1), mcp.Min(1)), mcp.WithNumber("page_size", mcp.Required(), mcp.Description("page size"), mcp.DefaultNumber(50), mcp.Min(1)), )
View Source
var Tool = tool.New()
Functions ¶
func CreateBranchFn ¶
func CreateBranchFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func CreateFileFn ¶
func CreateFileFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func CreateReleaseFn ¶ added in v0.1.9
func CreateReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func CreateRepoFn ¶
func CreateRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func CreateTagFn ¶ added in v0.1.9
func CreateTagFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func DeleteBranchFn ¶
func DeleteBranchFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func DeleteFileFn ¶
func DeleteFileFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func DeleteReleaseFn ¶ added in v0.1.9
func DeleteReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func DeleteTagFn ¶ added in v0.1.9
func DeleteTagFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func ForkRepoFn ¶
func ForkRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func GetDirContentFn ¶ added in v0.3.0
func GetDirContentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func GetFileContentFn ¶ added in v0.1.1
func GetFileContentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func GetLatestReleaseFn ¶ added in v0.1.9
func GetLatestReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func GetReleaseFn ¶ added in v0.1.9
func GetReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func GetTagFn ¶ added in v0.1.9
func GetTagFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func ListBranchesFn ¶
func ListBranchesFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func ListMyReposFn ¶
func ListMyReposFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func ListReleasesFn ¶ added in v0.1.9
func ListReleasesFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func ListRepoCommitsFn ¶
func ListRepoCommitsFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func ListTagsFn ¶ added in v0.1.9
func ListTagsFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
func RegisterTool ¶
func UpdateFileFn ¶
func UpdateFileFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
Types ¶
type ContentLine ¶ added in v0.3.1
type ListReleaseResult ¶ added in v0.1.9
type ListReleaseResult struct { ID int64 `json:"id"` TagName string `json:"tag_name"` Target string `json:"target_commitish"` Title string `json:"title"` IsDraft bool `json:"draft"` IsPrerelease bool `json:"prerelease"` CreatedAt time.Time `json:"created_at"` PublishedAt time.Time `json:"published_at"` }
To avoid return too many tokens, we need to provide at least information as possible llm can call get release to get more information
type ListTagResult ¶ added in v0.1.9
type ListTagResult struct { ID string `json:"id"` Name string `json:"name"` Commit *gitea_sdk.CommitMeta `json:"commit"` }
To avoid return too many tokens, we need to provide at least information as possible llm can call get tag to get more information
Click to show internal directories.
Click to hide internal directories.