feat(raw-api): register gitea_request tool and wire server dispatch

Registers gitea_request in AVAILABLE_TOOLS with write_operation=False
(deliberate: a static flag cannot describe a read-or-write tool; the handler
authorizes writes per-method) and maps the tool name to raw_api_request_tool in
the server handler registry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-26 12:26:56 +02:00
parent 2844c42ec8
commit 8e41fd12af
2 changed files with 36 additions and 0 deletions
+32
View File
@@ -718,6 +718,38 @@ AVAILABLE_TOOLS: list[MCPTool] = [
},
write_operation=True,
),
_tool(
"gitea_request",
(
"Generic escape hatch that calls an arbitrary Gitea REST endpoint "
"(method + path). Prefer the dedicated tools; use this only for "
"endpoints they do not cover. Subject to policy, write-mode and the "
"sensitive-path denylist. Methods other than GET/HEAD are writes and "
"require write-mode plus a whitelisted repository."
),
{
"type": "object",
"properties": {
"method": {
"type": "string",
"enum": ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"],
},
"path": {
"type": "string",
"description": "Gitea REST path, e.g. /repos/{owner}/{repo}/pulls/1/merge",
},
"query": {"type": "object", "description": "Optional query-string parameters"},
"body": {"type": "object", "description": "Optional JSON request body"},
},
"required": ["method", "path"],
"additionalProperties": False,
},
# write_operation is intentionally False: a static flag cannot describe a
# tool that is read OR write depending on the method. Setting it True
# would force the central write-mode gate on GETs and break reads. The
# handler is authoritative via its own per-method authorize() call.
write_operation=False,
),
]