run_code_rmcp 0.2.7

云函数服务,执行JS/TS/Python语言代码,脚本必须有约定的函数名称(handler/main),会调用约定的函数名称结果和日志返回.
Documentation
// Sample JavaScript file with handler function

// Log some debug information
console.log("Initializing JavaScript test...");

// Define a simple add function
function add(a, b) {
    console.log(`Adding ${a} + ${b}`);
    return a + b;
}

// Some processing
const numbers = [1, 2, 3, 4, 5];
console.log("Processing numbers:", numbers);

// Handler function that will be called to get the result
function handler() {
    console.log("Handler function called");
    
    // Calculate sum
    const sum = numbers.reduce((acc, num) => add(acc, num), 0);
    console.log("Final calculation completed");
    
    return `The sum of [${numbers.join(", ")}] is ${sum}`;
}