// frontend/components/AdminTabs/mcp/ToolRow.jsx // One row inside an expanded ServerCard. Tool name, risk badge, // "used by" agent chips, and a per-tool enable toggle. import React from "react"; const RISK_PALETTE = { low: { bg: "#0f3a26", text: "#86efac", label: "low" }, medium: { bg: "#3a2e0f", text: "#fcd34d", label: "med" }, high: { bg: "#3a0f0f", text: "#fca5a5", label: "high" }, }; export default function ToolRow({ tool, disabled, onToggle }) { const risk = RISK_PALETTE[tool.risk] || RISK_PALETTE.low; // Destructive tools cannot be toggled on by the UI; the backend's // PolicyEngine will reject a toggle PUT anyway, but disabling the // control surfaces the constraint up front. const lockEnable = tool.destructive; return (
{tool.name} {risk.label}
{(tool.used_by || []).length > 0 && used by} {(tool.used_by || []).map((agent) => ( {agent} ))}
onToggle(checked)} />
); } function Toggle({ checked, disabled, title, onChange }) { return ( ); }