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:
@@ -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,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user