Last updated February 25, 2025
The Script Editor provides a comprehensive environment for writing, managing, and executing JavaScript tool scripts within the MCPStudio platform. The interface features a file browser on the left and a powerful editor on the right, allowing users to efficiently develop and test custom tools.
The file browser displays the hierarchical structure of your selected folder.
The main editing area where you can write and modify JavaScript code. The editor includes syntax highlighting, line numbers, and a clean theme for comfortable coding.
From left to right, the toolbar provides essential functionality:
The editor supports JavaScript syntax with features like:
toolEntry()
// Example JavaScript Tool Script for MCPStudio
/**
* Entry point for all script tool calls
* @param {string} sid - Session identifier
* @param {string} handlerName - Method/handler name to execute
* @param {string} jsonParams - JSON string with parameters
* @returns {string} JSON result or plain text
*/
function toolEntry(sid, handlerName, jsonParams) {
console.log("Script started - SID: " + sid + ", Handler: " + handlerName + ", JSON: " + jsonParams);
try {
// Parse input parameters
var params = JSON.parse(jsonParams);
// Route to appropriate handler
switch (handlerName) {
case "processFile":
return processFile(params);
case "analyzeDirectory":
return analyzeDirectory(params);
case "createReport":
return createReport(params);
case "transformData":
return transformData(params);
default:
return JSON.stringify({error: "Unknown handler"});
}
} catch (e) {
return JSON.stringify({error: e.message});
}
}
This Script Editor provides a robust environment for developing and managing JavaScript tool scripts within the MCPStudio ecosystem.