-
+
+
+
+
+
+
@@ -914,6 +919,8 @@
document.body.removeChild(link);
}
+ let currentExportJson = [];
+
function exportJson() {
if (allTools.length === 0) {
alert("No tools loaded.");
@@ -929,11 +936,25 @@
delete clean._tempParsed;
return clean;
});
- const jsonContent = JSON.stringify({ tools: cleanTools }, null, 2);
- document.getElementById('jsonExportViewer').value = jsonContent;
+ currentExportJson = cleanTools;
+ document.getElementById('jsonSearchInput').value = '';
+ document.getElementById('jsonExportViewer').value = JSON.stringify({ tools: currentExportJson }, null, 2);
document.getElementById('jsonExportModal').style.display = 'flex';
}
+ function filterJsonExport() {
+ const keyword = document.getElementById('jsonSearchInput').value.toLowerCase();
+ if (!keyword) {
+ document.getElementById('jsonExportViewer').value = JSON.stringify({ tools: currentExportJson }, null, 2);
+ return;
+ }
+ const filtered = currentExportJson.filter(t =>
+ (t.name && t.name.toLowerCase().includes(keyword)) ||
+ (t.description && t.description.toLowerCase().includes(keyword))
+ );
+ document.getElementById('jsonExportViewer').value = JSON.stringify({ tools: filtered }, null, 2);
+ }
+
function closeJsonExportModal() {
document.getElementById('jsonExportModal').style.display = 'none';
}
@@ -957,6 +978,59 @@
document.body.removeChild(link);
}
+ function downloadPostmanCollection() {
+ if (allTools.length === 0) return;
+ const pmItems = currentExportJson.map(tool => {
+ const dummy = generateDummyPayload(tool);
+ return {
+ name: tool.name,
+ request: {
+ method: "POST",
+ header: [
+ { key: "Content-Type", value: "application/json" },
+ { key: "X-Agent-Id", value: "AUTO-TESTER" }
+ ],
+ body: {
+ mode: "raw",
+ raw: JSON.stringify({
+ jsonrpc: "2.0",
+ method: "tools/call",
+ params: { name: tool.name, arguments: dummy },
+ id: 1
+ }, null, 2)
+ },
+ url: {
+ raw: "{{baseUrl}}/mcp/api/v1/tools/call",
+ host: ["{{baseUrl}}"],
+ path: ["mcp", "api", "v1", "tools", "call"]
+ },
+ description: tool.description
+ }
+ };
+ });
+
+ const collection = {
+ info: {
+ name: "AXHUB MCP Tools API",
+ description: "Auto-generated Postman Collection for testing MCP Tools",
+ schema: "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
+ },
+ item: pmItems,
+ variable: [
+ { key: "baseUrl", value: "http://localhost:8081" }
+ ]
+ };
+
+ const blob = new Blob([JSON.stringify(collection, null, 2)], { type: 'application/json' });
+ const url = URL.createObjectURL(blob);
+ const link = document.createElement("a");
+ link.setAttribute("href", url);
+ link.setAttribute("download", `AXHUB_MCP_Tools.postman_collection.json`);
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ }
+
document.addEventListener('DOMContentLoaded', fetchTools);