feat(ui): Add Export JSON button to Tester UI
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 38s

This commit is contained in:
jade
2026-08-19 09:30:42 +09:00
parent 0122de84aa
commit eac481da41

View File

@@ -93,6 +93,9 @@
<p class="text-base" style="color:#a1a1aa;">Batch execute registered tools, customize payloads, and view detailed results.</p>
</div>
<div class="flex items-center gap-3">
<button id="exportJsonBtn" class="btn-sm flex items-center gap-2 h-10 px-4 text-sm" onclick="exportJson()">
Export JSON
</button>
<button id="exportCsvBtn" class="btn-sm flex items-center gap-2 h-10 px-4 text-sm" onclick="exportCsv()" style="display: none;">
Export CSV
</button>
@@ -888,6 +891,33 @@
document.body.removeChild(link);
}
function exportJson() {
if (allTools.length === 0) {
alert("No tools loaded.");
return;
}
// original tools array without the temp properties added for testing
const cleanTools = allTools.map(t => {
const clean = { ...t };
delete clean._customPayload;
delete clean._lastStatus;
delete clean._isFailed;
delete clean._latency;
delete clean._responseData;
delete clean._tempParsed;
return clean;
});
const jsonContent = JSON.stringify({ tools: cleanTools }, null, 2);
const blob = new Blob([jsonContent], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.setAttribute("href", url);
link.setAttribute("download", `mcp_tools_list_${new Date().toISOString().slice(0, 10)}.json`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
document.addEventListener('DOMContentLoaded', fetchTools);
</script>
</body>