Add tool detail view to admin pending page

- Click tool name to view full details in modal
- Shows description, arguments, steps (prompt/code), and README
- Approve/Reject buttons in detail modal
- New API endpoint GET /api/v1/admin/tools/<id> returns full tool config

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
rob
2026-01-16 14:55:50 -04:00
co-authored by Claude Opus 4.5
parent 706accc008
commit 3914ca74b3
2 changed files with 203 additions and 1 deletions
+53
View File
@@ -2459,6 +2459,59 @@ def create_app() -> Flask:
"meta": paginate(page, per_page, total),
})
@app.route("/api/v1/admin/tools/<int:tool_id>", methods=["GET"])
@require_moderator
def admin_get_tool(tool_id: int) -> Response:
"""Get full tool details for admin review."""
tool = query_one(
g.db,
"""
SELECT t.*, p.display_name as publisher_name
FROM tools t
JOIN publishers p ON t.publisher_id = p.id
WHERE t.id = ?
""",
[tool_id],
)
if not tool:
return error_response("TOOL_NOT_FOUND", "Tool not found", 404)
# Parse config YAML to extract steps
config = {}
if tool["config_yaml"]:
try:
config = yaml.safe_load(tool["config_yaml"]) or {}
except yaml.YAMLError:
pass
# Parse scrutiny report
scrutiny_report = None
if tool["scrutiny_report"]:
try:
scrutiny_report = json.loads(tool["scrutiny_report"])
except (json.JSONDecodeError, TypeError):
pass
return jsonify({
"data": {
"id": tool["id"],
"owner": tool["owner"],
"name": tool["name"],
"version": tool["version"],
"description": tool["description"],
"category": tool["category"],
"tags": tool["tags"],
"published_at": tool["published_at"],
"publisher_name": tool["publisher_name"],
"visibility": tool["visibility"],
"moderation_status": tool["moderation_status"],
"scrutiny_status": tool["scrutiny_status"],
"scrutiny_report": scrutiny_report,
"config": config,
"readme": tool["readme"] or "",
}
})
@app.route("/api/v1/admin/tools/<int:tool_id>/approve", methods=["POST"])
@require_moderator
def admin_approve_tool(tool_id: int) -> Response: