From bfb7d75fe47ea588495c5be8157a67b1fec67a13 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 6 Jun 2024 08:29:00 +0800 Subject: refactor: move tools/$lang/** to tools/** (#17) --- tools/may_execute_js_code.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tools/may_execute_js_code.js (limited to 'tools/may_execute_js_code.js') diff --git a/tools/may_execute_js_code.js b/tools/may_execute_js_code.js new file mode 100644 index 0000000..9575582 --- /dev/null +++ b/tools/may_execute_js_code.js @@ -0,0 +1,22 @@ +exports.declarate = function declarate() { + return { + "name": "may_execute_js_code", + "description": "Runs the javascript code in node.js.", + "parameters": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Javascript code to execute, such as `console.log(\"hello world\")`" + } + }, + "required": [ + "code" + ] + } + } +} + +exports.execute = function execute(data) { + eval(data.code) +} -- cgit v1.2.3