"添加前端模板和运行代码模块"

This commit is contained in:
Codex
2026-06-01 13:43:09 +08:00
parent 24045274ad
commit 8092c4b1f8
587 changed files with 99761 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import * as o from 'https://deno.land/x/cowsay/mod.ts'
// 使用类型注解时应确保使用的是支持该特性的环境或编译器(如 TypeScript
function add(input) {
console.log("test Add", input.a, "+", input.b);
let m = o.say({
text: 'hello every one'
})
console.log(m)
return input.a + input.b;
}
export default async function handler(input) {
let a = add(input)
console.log("计算结果=" + a)
return {
message: a,
};
}

View File

@@ -0,0 +1,30 @@
import axios from 'npm:axios';
// 使用axios发起HTTP请求的函数
async function fetchData(url) {
console.log(`正在请求: ${url}`);
try {
const response = await axios.get(url);
console.log(`请求成功,状态码: ${response.status}`);
return response.data;
} catch (error) {
console.error(`请求失败: ${error.message}`);
return { error: error.message };
}
}
export default async function handler(input) {
// 默认URL或从输入参数获取
const url = input.url || 'https://jsonplaceholder.typicode.com/todos/1';
console.log(`开始处理请求URL: ${url}`);
// 发起请求并获取数据
const data = await fetchData(url);
return {
message: '请求完成',
data: data,
timestamp: new Date().toISOString()
};
}

View File

@@ -0,0 +1,79 @@
import { join, basename } from "https://deno.land/std/path/mod.ts";
import { readLines } from "https://deno.land/std/io/mod.ts";
import { format } from "https://deno.land/std/datetime/mod.ts";
// 使用Deno标准库处理路径和文件
async function processPath(path) {
console.log(`处理路径: ${path}`);
// 使用path模块处理路径
const fileName = basename(path);
console.log(`文件名: ${fileName}`);
const fullPath = join("/tmp", fileName);
console.log(`完整路径: ${fullPath}`);
// 获取当前时间并格式化
const now = new Date();
const formattedDate = format(now, "yyyy-MM-dd HH:mm:ss");
console.log(`当前时间: ${formattedDate}`);
return {
originalPath: path,
fileName: fileName,
fullPath: fullPath,
timestamp: formattedDate
};
}
// 模拟读取文件内容
async function simulateFileReading() {
const text = `这是第一行
这是第二行
这是第三行
这是最后一行`;
// 使用TextEncoder和StringReader代替Deno.Buffer
const encoder = new TextEncoder();
const decoder = new TextDecoder();
const data = encoder.encode(text);
// 创建一个可读流
const stream = new ReadableStream({
start(controller) {
controller.enqueue(data);
controller.close();
}
});
// 将流转换为Reader
const reader = stream.getReader();
console.log("开始读取文件内容:");
// 手动处理文本行
const lines = text.split('\n');
for (let i = 0; i < lines.length; i++) {
console.log(`${i+1}行: ${lines[i]}`);
}
return lines;
}
export default async function handler(input) {
console.log("开始处理");
// 处理路径
const path = input.path || "example.txt";
const pathInfo = await processPath(path);
// 模拟读取文件
const fileLines = await simulateFileReading();
return {
message: '处理完成',
pathInfo: pathInfo,
fileContent: fileLines,
linesCount: fileLines.length
};
}

View File

@@ -0,0 +1,59 @@
// 使用ES模块导入方式
import { createHash } from "node:crypto";
import { Buffer } from "node:buffer";
// 使用Node.js内置模块处理数据
function hashData(data, algorithm = 'sha256') {
console.log(`使用 ${algorithm} 算法处理数据`);
// 将数据转换为Buffer
const buffer = typeof data === 'string'
? Buffer.from(data)
: Buffer.from(JSON.stringify(data));
// 创建哈希
const hash = createHash(algorithm);
hash.update(buffer);
// 获取哈希结果
const digest = hash.digest('hex');
console.log(`哈希结果: ${digest}`);
return digest;
}
// 加密数据
function encryptData(data, salt = 'default-salt') {
console.log(`加密数据,使用盐值: ${salt}`);
// 组合数据和盐值
const combined = `${data}:${salt}:${Date.now()}`;
// 生成多种哈希
const sha256Hash = hashData(combined, 'sha256');
const md5Hash = hashData(combined, 'md5');
return {
original: data,
salt,
sha256: sha256Hash,
md5: md5Hash,
timestamp: new Date().toISOString()
};
}
export default async function handler(input) {
console.log("开始处理加密任务");
// 获取输入数据
const data = input.data || "这是需要加密的默认数据";
const salt = input.salt || "custom-salt-" + Math.floor(Math.random() * 1000);
// 加密数据
const encryptedResult = encryptData(data, salt);
return {
message: '加密处理完成',
result: encryptedResult
};
}

View File

@@ -0,0 +1,79 @@
import { assertEquals } from "jsr:@std/assert";
import { delay } from "jsr:@std/async";
import { bold, red, green } from "jsr:@std/fmt/colors";
// 使用JSR标准库中的工具函数
async function runTests(input) {
console.log(bold("开始运行测试..."));
// 使用delay函数模拟异步操作
console.log("等待1秒...");
await delay(1000);
// 测试结果数组
const results = [];
// 测试1: 加法运算
try {
const a = input.a || 5;
const b = input.b || 3;
const expected = input.expected || 8;
console.log(`测试加法: ${a} + ${b} = ${expected}`);
assertEquals(a + b, expected);
console.log(green("✓ 加法测试通过"));
results.push({ name: "加法测试", success: true });
} catch (error) {
console.log(red(`✗ 加法测试失败: ${error.message}`));
results.push({ name: "加法测试", success: false, error: error.message });
}
// 测试2: 字符串操作
try {
const str1 = input.str1 || "hello";
const str2 = input.str2 || "world";
const expectedStr = input.expectedStr || "hello world";
console.log(`测试字符串连接: "${str1}" + " " + "${str2}" = "${expectedStr}"`);
assertEquals(`${str1} ${str2}`, expectedStr);
console.log(green("✓ 字符串测试通过"));
results.push({ name: "字符串测试", success: true });
} catch (error) {
console.log(red(`✗ 字符串测试失败: ${error.message}`));
results.push({ name: "字符串测试", success: false, error: error.message });
}
// 等待再次展示结果
console.log("处理结果中...");
await delay(500);
return results;
}
export default async function handler(input) {
console.log(bold("JSR依赖示例"));
// 运行测试
const testResults = await runTests(input);
// 统计结果
const passed = testResults.filter(r => r.success).length;
const failed = testResults.filter(r => !r.success).length;
// 使用彩色输出显示结果
console.log(bold("\n测试结果摘要:"));
console.log(green(`通过: ${passed}`));
console.log(failed > 0 ? red(`失败: ${failed}`) : green(`失败: ${failed}`));
return {
message: '测试完成',
results: testResults,
summary: {
total: testResults.length,
passed,
failed
}
};
}

View File

@@ -0,0 +1,74 @@
// 首先创建一个本地模块,通过相对路径引入
// 注意这个示例假设有一个名为utils.js的本地模块
// 模拟本地utils.js模块的内容
const utils = {
formatNumber(num) {
return num.toLocaleString('zh-CN');
},
calculateTax(amount, rate = 0.1) {
return amount * rate;
},
generateId() {
return `id-${Date.now()}-${Math.floor(Math.random() * 1000)}`;
},
formatDate(date = new Date()) {
return date.toLocaleDateString('zh-CN');
}
};
// 使用本地模块的函数
function processOrder(order) {
console.log(`处理订单: ${order.id || utils.generateId()}`);
// 计算订单总额
const total = order.items.reduce((sum, item) => sum + (item.price * item.quantity), 0);
console.log(`订单总额: ${utils.formatNumber(total)}`);
// 计算税费
const taxRate = order.taxRate || 0.13;
const tax = utils.calculateTax(total, taxRate);
console.log(`税费(${taxRate * 100}%): ${utils.formatNumber(tax)}`);
// 计算最终金额
const finalAmount = total + tax;
console.log(`最终金额: ${utils.formatNumber(finalAmount)}`);
// 生成订单日期
const orderDate = order.date ? new Date(order.date) : new Date();
console.log(`订单日期: ${utils.formatDate(orderDate)}`);
return {
id: order.id || utils.generateId(),
items: order.items,
subtotal: total,
tax: tax,
total: finalAmount,
date: utils.formatDate(orderDate)
};
}
export default async function handler(input) {
console.log("开始处理订单");
// 默认订单或从输入获取
const order = input.order || {
items: [
{ name: "产品A", price: 100, quantity: 2 },
{ name: "产品B", price: 50, quantity: 1 },
{ name: "产品C", price: 200, quantity: 3 }
],
taxRate: 0.13
};
// 处理订单
const processedOrder = processOrder(order);
return {
message: '订单处理完成',
order: processedOrder
};
}

View File

@@ -0,0 +1,43 @@
import _ from 'npm:lodash';
// 使用lodash处理数据的函数
function processData(input) {
console.log("输入数据:", input);
// 使用lodash的chunk方法将数组分块
if (Array.isArray(input.data)) {
const chunks = _.chunk(input.data, input.chunkSize || 2);
console.log("数据分块结果:", chunks);
// 使用lodash的map方法处理每个块
const processedChunks = _.map(chunks, (chunk) => {
return {
items: chunk,
sum: _.sum(chunk),
average: _.mean(chunk)
};
});
return processedChunks;
}
return { error: "输入数据不是数组" };
}
export default async function handler(input) {
console.log("开始处理数据");
// 从输入获取数据,或使用默认数据
const data = input.data || [1, 2, 3, 4, 5, 6, 7, 8, 9];
const chunkSize = input.chunkSize || 3;
// 处理数据
const result = processData({ data, chunkSize });
return {
message: '数据处理完成',
originalData: data,
processedData: result,
timestamp: new Date().toISOString()
};
}

View File

@@ -0,0 +1,13 @@
//引入js组件,必须是http(s)形式引入,可以去网站: https://deno.land/x 搜索自己所需组件
//下面是一个引入示例
//import * as o from https://deno.land/x/cowsay/mod.ts
//网络请求,可以直接使用fetch ,具体自行查阅 fetch 文档
//打印日志使用console,比如:console.log
// 入口函数不可修改否则无法执行args 为配置的入参
export default async function main(args) {
// 构建输出对象出参中的key需与配置的出参保持一致
return {
key: 'value',
};
}

View File

@@ -0,0 +1,26 @@
import requests
from bs4 import BeautifulSoup
# 发送请求到百度
url = 'https://www.baidu.com'
response = requests.get(url)
# 检查请求是否成功
if response.status_code == 200:
# 解析网页内容
soup = BeautifulSoup(response.text, 'html.parser')
# 提取你想要的信息,例如标题
title = soup.title.string
else:
print(f"请求失败,状态码:")
# 入口函数不可修改否则无法执行args 为配置的入参
def main(args: dict) -> dict:
params = args.get("params")
# 构建输出对象出参中的key需与配置的出参保持一致
ret = {
"key": "value"
}
return ret

View File

@@ -0,0 +1,20 @@
// 使用类型注解时应确保使用的是支持该特性的环境或编译器(如 TypeScript
function add(input) {
console.log("test Add", input.a, "+", input.b);
// 简单的字符串输出,不使用外部模块
console.log("Hello from JavaScript!");
return input.a + input.b;
}
function handler(input) {
console.log("输入参数:", JSON.stringify(input));
let a = add(input);
console.log("计算结果=" + a);
return {
message: a,
};
}

View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python3
import pandas as pd
import logging
import json
# 创建一个简单的数据结构不使用pandas
data = {
'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [25, 30, 35]
}
df = pd.DataFrame(data)
# 记录数据信息
logging.info(f"Created data structure:\n{json.dumps(data, indent=2)}")
def main(args: dict) -> dict:
logging.info(f"input args: {args}")
params = args.get("params")
# 处理params为None的情况
if params is None:
logging.warning("params is None, using default values")
params = {"input": "default_value"}
elif not isinstance(params, dict):
logging.warning(f"params is not a dictionary: {type(params)}, using default values")
params = {"input": str(params)}
elif "input" not in params:
logging.warning("input key not found in params, using default value")
params["input"] = "default_value"
# 构建输出对象
ret = {
"key0": params['input'], # 使用input参数值
"key1": ["hello", "world"], # 输出一个数组
"key2": { # 输出一个Object
"key21": "hi"
},
}
return ret

View File

@@ -0,0 +1,25 @@
// 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}`;
}

View File

@@ -0,0 +1,75 @@
// Test JavaScript script with large text parameters to verify "Argument list too long" fix
// Generate a large text parameter (>2MB) to test the temporary file parameter passing solution
function generateLargeText(sizeInMB) {
const chunk = "This is a test chunk of text designed to generate large parameters. ".repeat(100);
const iterations = Math.ceil((sizeInMB * 1024 * 1024) / chunk.length);
let result = "";
for (let i = 0; i < iterations; i++) {
result += chunk + `Iteration ${i}\n`;
}
return result;
}
// Handler function that processes large text parameters
function handler(args) {
console.log("Handler function called with large parameters");
// Test that we received the large text parameter
if (!args || !args.largeText) {
console.log("ERROR: No largeText parameter found");
return { success: false, error: "Missing largeText parameter" };
}
const largeText = args.largeText;
console.log("Received large text parameter, length:", largeText.length);
console.log("Large text parameter size (MB):", (largeText.length / 1024 / 1024).toFixed(2));
// Verify the text contains expected content
if (largeText.includes("This is a test chunk of text designed to generate large parameters")) {
console.log("SUCCESS: Large text parameter contains expected content");
// Count occurrences of "Iteration" to verify data integrity
const iterationCount = (largeText.match(/Iteration \d+/g) || []).length;
console.log("Found", iterationCount, "iterations in the text");
// Return some statistics about the processed data
return {
success: true,
message: "Successfully processed large text parameter",
textSize: largeText.length,
sizeMB: (largeText.length / 1024 / 1024).toFixed(2),
iterationCount: iterationCount,
sampleText: largeText.substring(0, 100) + "..."
};
} else {
console.log("ERROR: Large text parameter does not contain expected content");
return { success: false, error: "Invalid content in largeText parameter" };
}
}
// This part won't be executed when the code is run through the MCP runner
if (typeof require !== 'undefined' && require.main === module) {
console.log("Running large parameter test directly...");
// Generate test data (3MB to ensure we exceed the 2MB threshold)
const largeText = generateLargeText(3);
console.log("Generated test data, size:", (largeText.length / 1024 / 1024).toFixed(2), "MB");
// Create test arguments
const testArgs = {
largeText: largeText,
additionalParam: "test value",
numberParam: 42
};
console.log("Calling handler with large parameters...");
const result = handler(testArgs);
console.log("Result:", JSON.stringify(result, null, 2));
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = { handler, generateLargeText };
}

View File

@@ -0,0 +1,39 @@
// JavaScript测试文件演示参数传递
// 打印一些调试信息
console.log("JavaScript脚本开始执行...");
// 定义一个加法函数
function add(a, b) {
console.log(`正在计算: ${a} + ${b}`);
return a + b;
}
// 处理一些数据
const numbers = [1, 2, 3, 4, 5];
console.log(`处理数字列表: ${numbers}`);
/**
* 处理函数,接收参数并返回结果
* 注意:这个函数必须存在,并且会被框架调用来获取结果
*/
function handler(input) {
console.log(`接收到的参数: ${JSON.stringify(input)}`);
// 从参数中获取值,提供默认值
const a = input.a || 0;
const b = input.b || 0;
const name = input.name || "用户";
// 计算结果
const result = add(a, b);
console.log(`计算完成: ${a} + ${b} = ${result}`);
// 返回结果
return {
sum: result,
numbers: numbers,
greeting: `你好,${name}`,
message: `成功计算 ${a} + ${b} 的结果`
};
}

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python3
# Sample Python file with handler function
import time
time.time()
# Debug print to confirm script execution
print("DEBUGGING: Script is being executed!")
# Log some debug information
print("Initializing Python test...")
# Define a simple function
def multiply(a, b):
print(f"Multiplying {a} * {b}")
return a * b
# Some processing
numbers = [1, 2, 3, 4, 5]
print(f"Processing numbers: {numbers}")
# Handler function that will be called to get the result
def handler(args):
print("Handler function called")
print(f"Received args: {args}")
# Calculate product (using the predefined numbers)
product = 1
for num in numbers:
product = multiply(product, num)
print("Final calculation completed")
return f"The product of {numbers} is {product}"
# This part won't be executed when the code is run through the MCP runner
if __name__ == "__main__":
print("Running directly, calling handler...")
# Create sample args for direct execution
sample_args = {"test": "direct_execution", "data": [1, 2, 3]}
result = handler(sample_args)
print(f"Result: {result}")

View File

@@ -0,0 +1,70 @@
#!/usr/bin/env python3
# Test Python script with large text parameters to verify "Argument list too long" fix
import sys
import json
import time
# Generate a large text parameter (>2MB) to test the temporary file parameter passing solution
def generate_large_text(size_in_mb):
chunk = "This is a test chunk of text designed to generate large parameters for Python testing. " * 100
iterations = (size_in_mb * 1024 * 1024) // len(chunk)
result = ""
for i in range(iterations):
result += chunk + f"Iteration {i}\n"
return result
# Handler function that processes large text parameters
def handler(args):
print("Handler function called with large parameters")
# Test that we received the large text parameter
if not args or 'largeText' not in args:
print("ERROR: No largeText parameter found")
return {"success": False, "error": "Missing largeText parameter"}
large_text = args['largeText']
print(f"Received large text parameter, length: {len(large_text)}")
print(f"Large text parameter size (MB): {len(large_text) / 1024 / 1024:.2f}")
# Verify the text contains expected content
expected_content = "This is a test chunk of text designed to generate large parameters for Python testing"
if expected_content in large_text:
print("SUCCESS: Large text parameter contains expected content")
# Count occurrences of "Iteration" to verify data integrity
iteration_count = large_text.count("Iteration")
print(f"Found {iteration_count} iterations in the text")
return {
"success": True,
"message": "Successfully processed large text parameter",
"textSize": len(large_text),
"sizeMB": round(len(large_text) / 1024 / 1024, 2),
"iterationCount": iteration_count,
"sampleText": large_text[:100] + "..."
}
else:
print("ERROR: Large text parameter does not contain expected content")
return {"success": False, "error": "Invalid content in largeText parameter"}
# This part won't be executed when the code is run through the MCP runner
if __name__ == "__main__":
print("Running large parameter test directly...")
# Generate test data (3MB to ensure we exceed the 2MB threshold)
large_text = generate_large_text(3)
print(f"Generated test data, size: {len(large_text) / 1024 / 1024:.2f} MB")
# Create test arguments
test_args = {
"largeText": large_text,
"additionalParam": "test value",
"numberParam": 42
}
print("Calling handler with large parameters...")
result = handler(test_args)
print("Result:", json.dumps(result, indent=2))

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env python3
# 测试logging模块的日志捕获功能
import logging
import json
# 配置日志
logging.basicConfig(level=logging.DEBUG)
# 使用不同级别的日志
def log_messages():
logging.debug("这是一条DEBUG级别的日志")
logging.info("这是一条INFO级别的日志")
logging.warning("这是一条WARNING级别的日志")
logging.error("这是一条ERROR级别的日志")
logging.critical("这是一条CRITICAL级别的日志")
# 使用格式化
data = {"name": "测试", "value": 42}
logging.info(f"格式化的JSON数据: {json.dumps(data, ensure_ascii=False)}")
return "日志测试完成"
def handler(args):
# 记录输入参数
logging.info(f"收到参数: {args}")
# 生成一些日志
result = log_messages()
# 返回结果
return {
"message": result,
"log_count": 6, # 总共记录了6条日志
"args": args
}

View File

@@ -0,0 +1,33 @@
import json
import os
# 打印一些调试信息
print("Python脚本开始执行...")
# 定义一个简单的加法函数
def add(a, b):
print("正在计算: " + str(a) + " + " + str(b))
return a + b
# 处理一些数据
numbers = [1, 2, 3, 4, 5]
print("处理数字列表: " + str(numbers))
# 入口函数,接收参数
def main(args):
print("接收到的参数: " + str(args))
# 从参数中获取值
a = args.get("a", 0)
b = args.get("b", 0)
# 计算结果
result = add(a, b)
print("计算完成: " + str(a) + " + " + str(b) + " = " + str(result))
# 返回结果
return {
"sum": result,
"numbers": numbers,
"message": "成功计算 " + str(a) + " + " + str(b) + " 的结果"
}

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env python3
# 简单的Python测试脚本用于测试参数传递机制
def main(args: dict) -> dict:
print(f"接收到的参数: {args}")
# 尝试通过两种方式获取参数
direct_params = args.get("input", "direct_default")
nested_params = None
params = args.get("params")
if params:
if isinstance(params, dict):
nested_params = params.get("input", "nested_default")
else:
nested_params = str(params)
# 返回结果,展示两种方式获取的参数
return {
"direct_access": direct_params,
"nested_access": nested_params,
"args_structure": args
}

View File

@@ -0,0 +1,46 @@
import json
import os
# 打印一些调试信息
print("Python类型测试脚本开始执行...")
# 入口函数,接收参数并返回不同类型的值
def main(args):
print("接收到的参数:", args)
# 获取要测试的类型
test_type = args.get("type", "string")
# 根据参数返回不同类型的值
if test_type == "string":
print("返回字符串类型")
return "这是一个字符串"
elif test_type == "number":
print("返回数字类型")
return 12345
elif test_type == "boolean":
print("返回布尔类型")
return True
elif test_type == "null":
print("返回None类型")
return None
elif test_type == "list":
print("返回列表类型")
return [1, 2, 3, "", "", True]
elif test_type == "dict":
print("返回字典类型")
return {
"name": "测试用户",
"age": 30,
"is_active": True,
"tags": ["python", "rust", "json"]
}
else:
print("未知类型,返回默认字符串")
return "未知类型"

View File

@@ -0,0 +1,41 @@
// Sample TypeScript file with handler function
// Log some debug information
console.log("Initializing TypeScript test...");
// Define a simple add function with type annotations
function add(a: number, b: number): number {
console.log(`Adding ${a} + ${b}`);
return a + b;
}
// Some processing with type annotations
const numbers: number[] = [1, 2, 3, 4, 5];
console.log("Processing numbers:", numbers);
// Interface for a person object
interface Person {
name: string;
age: number;
}
// Create a person object
const person: Person = {
name: "TypeScript User",
age: 30
};
console.log("Person object:", person);
/**
* Handler function that will be called to get the result
* 注意:这个函数必须存在,并且会被框架调用来获取结果
*/
function handler(): string {
console.log("Handler function called");
// Calculate sum
const sum = numbers.reduce((acc, num) => add(acc, num), 0);
console.log("Final calculation completed");
return `Hello ${person.name}! The sum of [${numbers.join(", ")}] is ${sum}`;
}

View File

@@ -0,0 +1,46 @@
// TypeScript测试文件演示参数传递
// 定义参数接口
interface InputParams {
a: number;
b: number;
name?: string;
}
// 打印一些调试信息
console.log("TypeScript脚本开始执行...");
// 定义一个带类型的加法函数
function add(a: number, b: number): number {
console.log(`正在计算: ${a} + ${b}`);
return a + b;
}
// 处理一些数据
const numbers: number[] = [1, 2, 3, 4, 5];
console.log(`处理数字列表: ${numbers}`);
/**
* 处理函数,接收参数并返回结果
* 注意:这个函数必须存在,并且会被框架调用来获取结果
*/
function handler(input: InputParams): object {
console.log(`接收到的参数: ${JSON.stringify(input)}`);
// 从参数中获取值,提供默认值
const a = input.a || 0;
const b = input.b || 0;
const name = input.name || "用户";
// 计算结果
const result = add(a, b);
console.log(`计算完成: ${a} + ${b} = ${result}`);
// 返回结果
return {
sum: result,
numbers: numbers,
greeting: `你好,${name}`,
message: `成功计算 ${a} + ${b} 的结果`
};
}