diff --git a/dap-gateway/src/main/resources/static/tester.html b/dap-gateway/src/main/resources/static/tester.html index 7ae48a56..42f22c4e 100644 --- a/dap-gateway/src/main/resources/static/tester.html +++ b/dap-gateway/src/main/resources/static/tester.html @@ -93,6 +93,9 @@

Batch execute registered tools, customize payloads, and view detailed results.

+ @@ -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);