mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2026-03-25 14:25:13 +00:00
Add get_commit, get_repository_tree, and search_issues tools (#162)
Add three new read-only tools inspired by the GitHub MCP server: - `get_commit`: Get details of a specific commit by SHA, branch, or tag - `get_repository_tree`: Get the file tree of a repository with optional recursive traversal, pagination, and ref support - `search_issues`: Search issues and pull requests across all accessible repositories with filters for state, type, labels, and owner --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/162 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-committed-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -184,6 +184,28 @@ func slimContents(c *gitea_sdk.ContentsResponse) map[string]any {
|
||||
return m
|
||||
}
|
||||
|
||||
func slimTree(t *gitea_sdk.GitTreeResponse) map[string]any {
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
entries := make([]map[string]any, 0, len(t.Entries))
|
||||
for _, e := range t.Entries {
|
||||
entries = append(entries, map[string]any{
|
||||
"path": e.Path,
|
||||
"mode": e.Mode,
|
||||
"type": e.Type,
|
||||
"size": e.Size,
|
||||
"sha": e.SHA,
|
||||
})
|
||||
}
|
||||
return map[string]any{
|
||||
"sha": t.SHA,
|
||||
"truncated": t.Truncated,
|
||||
"total_count": t.TotalCount,
|
||||
"tree": entries,
|
||||
}
|
||||
}
|
||||
|
||||
func slimDirEntries(entries []*gitea_sdk.ContentsResponse) []map[string]any {
|
||||
out := make([]map[string]any, 0, len(entries))
|
||||
for _, c := range entries {
|
||||
|
||||
Reference in New Issue
Block a user