feat(connector): add search and fetch tools for ChatGPT connectors

Add a new "connector" domain exposing exactly-named "search" and "fetch"
MCP tools for ChatGPT-style connector compatibility (gitea#84). search
looks up repositories via the existing SearchRepos SDK call, optionally
resolving an owner/org name to an owner ID, and returns concise entries
(id, name, url, html_url). fetch reuses GetContents to read a file and
decodes its base64 content, returning path, sha, size, encoding and the
decoded content. Registers connector.Tool in operation.go and documents
the two tools in all three README tables.

Co-Authored-By: Codet <codet@commitgo.dev> (GPT-5-Codex)
This commit is contained in:
Lunny Xiao
2026-08-24 00:23:37 -07:00
parent 815a0e26aa
commit d7d0cf34d6
7 changed files with 351 additions and 1 deletions
+2 -1
View File
@@ -14,6 +14,7 @@ import (
"time"
"gitea.com/gitea/gitea-mcp/operation/actions"
"gitea.com/gitea/gitea-mcp/operation/connector"
"gitea.com/gitea/gitea-mcp/operation/issue"
"gitea.com/gitea/gitea-mcp/operation/label"
"gitea.com/gitea/gitea-mcp/operation/milestone"
@@ -47,7 +48,7 @@ var (
domainTools = []*tool.Tool{
user.Tool, actions.Tool, repo.Tool, notification.Tool, issue.Tool,
label.Tool, milestone.Tool, packages.Tool, pull.Tool, search.Tool,
version.Tool, wiki.Tool, timetracking.Tool,
version.Tool, wiki.Tool, timetracking.Tool, connector.Tool,
repo.FileTool, repo.BranchTool, repo.TagTool, repo.CommitTool, repo.ReleaseTool,
}
)