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
View File
@@ -191,6 +191,8 @@ Once configured, try `list all my repositories` in the chat box.
| get_release | release | Read | Get a release by ID |
| get_latest_release | release | Read | Get the latest release |
| list_releases | release | Read | List repository releases |
| search | connector | Read | Search Gitea repositories by keyword for ChatGPT-style connectors |
| fetch | connector | Read | Fetch a file's decoded content and metadata for ChatGPT-style connectors |
> **Note:** Several tools are consolidated, action-based tools, a single tool exposes multiple operations through a `method` parameter. Tools with `Write` access are hidden when the server runs in read-only mode (`-r` / `GITEA_READONLY`), and the exposed tool set can be filtered by scope with `-S` / `--scope` (`GITEA_SCOPES`) and/or by individual tool name with `-O` / `--tools` (`GITEA_TOOLS`).