name: github description: 搜索仓库、浏览代码、管理问题和拉取请求,以及通过GitHub OAuth(3LO)创建分支和拉取请求。
GitHub
可用工具
读取
- github_search_repos(query, max_results?):搜索GitHub仓库。
- github_get_repo(owner, repo):获取仓库详情(描述、星标、语言、主题)。
- github_list_issues(owner, repo, state?, labels?, max_results?):列出问题。
state:open | closed | all。 - github_get_issue(owner, repo, issue_number):获取单个问题及其评论。
- github_list_pulls(owner, repo, state?, max_results?):列出拉取请求。
- github_get_pull(owner, repo, pull_number):获取单个拉取请求及其差异摘要。
- github_get_file(owner, repo, path, ref?):获取文件内容。
ref默认为默认分支。 - github_search_code(query, max_results?):跨GitHub搜索代码(使用
repo:owner/name限定搜索范围)。
写入(需要用户批准)
- github_create_branch(owner, repo, branch, from_branch?):创建新分支。
- github_push_files(owner, repo, branch, files, message):创建或更新文件。
files:{path, content}列表。 - github_create_pull_request(owner, repo, title, body, head, base?):打开拉取请求。
使用指南
- 修改文件前,始终使用
github_get_file读取现有文件。 - 写入操作需要用户确认——调用前解释将更改什么。
- 对于多文件更改:创建一个分支 → 在同一个
github_push_files调用中推送所有文件 → 打开PR。 - 使用
github_search_code并添加repo:owner/name限定符,将搜索范围限定到特定仓库。