MCPcopy Create free account
hub / github.com/Xyntopia/taskyon / scopedExecution

Function scopedExecution

src/modules/tools.ts:281–300  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

279 try {
280 // Create a scoped environment for execution
281 const scopedExecution = () => {
282 const logMessages: string[] = [];
283 // Override console.log within this function's scope
284 const console = {
285 log: (...args: unknown[]) => {
286 logMessages.push(args.join(' '));
287 },
288 };
289
290 try {
291 // Execute the JavaScript code
292 const result = eval(javascriptCode) as unknown;
293 return {
294 result: result ? result : undefined,
295 'console.log': logMessages,
296 };
297 } catch (e) {
298 throw e;
299 }
300 };
301
302 // Execute the scoped function and capture the result
303 const executionResult = scopedExecution();

Callers 1

tools.tsFile · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected