get_edss_documentation_enhanced
Retrieve Open-E JovianDSS REST API documentation with automatic version detection and jQuery processing to reveal hidden content.
Instructions
Get EDSS documentation with automatic version discovery and jQuery processing
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| version | No | Version: 'latest', 'trunk', or specific release name | latest |
| apiVersion | No | v4 | |
| useJavaScript | No | Process with jQuery to reveal hidden content |
Implementation Reference
- index.js:340-423 (handler)Main handler function for the 'get_edss_documentation_enhanced' tool. Retrieves EDSS documentation with automatic version discovery and optional jQuery processing to reveal hidden content.
async getDocumentationEnhanced(args) { const version = args?.version || 'latest'; const apiVersion = args?.apiVersion || 'v4'; const useJavaScript = args?.useJavaScript !== false; // default true try { // Get available links const links = await this.discoverDocumentationLinks(); // Find the appropriate link let targetLink = null; const lookupKey = `${version.toLowerCase()}_${apiVersion}`; if (links[lookupKey]) { targetLink = links[lookupKey]; } else if (version === 'latest') { // Try to find any latest version targetLink = links[`latest_${apiVersion}`] || links[Object.keys(links).find(k => k.includes('latest'))]; } else if (version === 'trunk') { targetLink = links[`trunk_${apiVersion}`] || links[Object.keys(links).find(k => k.includes('trunk'))]; } if (!targetLink) { throw new Error(`Could not find documentation for version: ${version}, apiVersion: ${apiVersion}`); } // Download ZIP file const response = await fetch(targetLink.zipUrl); if (!response.ok) { throw new Error(`Failed to download documentation: ${response.status}`); } const zipBuffer = await response.arrayBuffer(); if (useJavaScript) { // Process with jQuery to reveal hidden content const processedHTML = await this.processZipWithJQuery(zipBuffer); return { content: [ { type: "text", text: `Enhanced EDSS Documentation (${targetLink.release} ${apiVersion})\n` + `Source: ${targetLink.zipUrl}\n` + `Processed with jQuery: ${useJavaScript ? 'YES' : 'NO'}\n\n` + processedHTML } ] }; } else { // Standard ZIP extraction const zip = new JSZip(); const contents = await zip.loadAsync(zipBuffer); let htmlContent = ''; for (const [path, file] of Object.entries(contents.files)) { if (path.endsWith('.html') && !file.dir) { htmlContent = await file.async('text'); break; } } return { content: [ { type: "text", text: `EDSS Documentation (${targetLink.release} ${apiVersion})\n` + `Source: ${targetLink.zipUrl}\n\n` + htmlContent } ] }; } } catch (error) { return { content: [ { type: "text", text: `Error retrieving enhanced documentation: ${error.message}` } ] }; } } - index.js:150-172 (schema)Tool registration schema with input validation. Defines parameters: version (string, default 'latest'), apiVersion (enum v3/v4, default v4), and useJavaScript (boolean, default true).
name: "get_edss_documentation_enhanced", description: "Get EDSS documentation with automatic version discovery and jQuery processing", inputSchema: { type: "object", properties: { version: { type: "string", default: "latest", description: "Version: 'latest', 'trunk', or specific release name" }, apiVersion: { type: "string", enum: ["v3", "v4"], default: "v4" }, useJavaScript: { type: "boolean", default: true, description: "Process with jQuery to reveal hidden content" } } } } - index.js:201-202 (registration)Registration of the tool in the call handler switch statement, routing to this.getDocumentationEnhanced(args).
case "get_edss_documentation_enhanced": return await this.getDocumentationEnhanced(args); - index.js:428-486 (helper)Helper function processZipWithJQuery: extracts HTML and jQuery from a ZIP file, creates a virtual DOM with JSDOM, injects jQuery, and returns the processed HTML.
async processZipWithJQuery(zipBuffer) { try { const zip = new JSZip(); const contents = await zip.loadAsync(zipBuffer); // Find HTML and jQuery files let mainHTML = ''; let jqueryCode = ''; for (const [path, file] of Object.entries(contents.files)) { if (path.endsWith('.html') && !file.dir && !mainHTML) { mainHTML = await file.async('text'); } if (path.includes('jquery') && path.endsWith('.js')) { jqueryCode = await file.async('text'); } } if (!mainHTML) { throw new Error('No HTML file found in ZIP'); } if (!jqueryCode) { console.warn('No jQuery found in ZIP, returning unprocessed HTML'); return mainHTML; } // Create virtual DOM const dom = new JSDOM(mainHTML, { runScripts: "dangerously", resources: "usable" }); const window = dom.window; const document = window.document; // Inject jQuery const scriptElement = document.createElement('script'); scriptElement.textContent = jqueryCode; document.head.appendChild(scriptElement); // Wait for jQuery to load and then reveal content await new Promise(resolve => { setTimeout(async () => { try { await this.revealAllContent(window); } catch (error) { console.warn('jQuery processing error:', error.message); } resolve(); }, 1000); }); return document.documentElement.outerHTML; } catch (error) { throw new Error(`jQuery processing failed: ${error.message}`); } } - index.js:491-515 (helper)Helper function revealAllContent: uses jQuery to simulate clicks on toggle buttons and reveal hidden elements in the documentation.
async revealAllContent(window) { const $ = window.$; if (!$) { throw new Error('jQuery not available'); } // Simulate clicks on all toggle buttons $('.toggleOperation').each(function() { try { $(this).trigger('click'); } catch (e) { // Ignore individual click errors } }); // Force show hidden elements $('div[style*="display: none"]').show(); $('.content.func_doc').show(); $('.content.func_src').show(); $('.operation').show(); $('.endpoint').show(); // Remove any remaining display: none styles $('[style*="display: none"]').css('display', ''); }