This commit is contained in:
seb
2026-10-07 19:16:42 +02:00
parent 1743cef11c
commit 857963b1c3
20 changed files with 892 additions and 182 deletions

View File

@@ -133,21 +133,25 @@ export function createJavascriptExecuteTool({ googleAuthId }) {
additionalProperties: false,
required: ['code'],
properties: {
note: {
type: ['string', 'null'],
description: 'A note explaining what this code is doing (or null). This note will be displayed to the user while the code is executing.',
},
code: {
type: 'string',
description: 'JavaScript code. Assign result to `module.exports`. Async code must use IIFE. Do not use require() or import.',
},
timeout: {
type: 'number',
description: `Execution timeout in ms. Default ${DEFAULT_TIMEOUT_MS}, max ${MAX_TIMEOUT_MS}.`,
type: ['number', 'null'],
description: `Execution timeout in ms or null. Default ${DEFAULT_TIMEOUT_MS}, max ${MAX_TIMEOUT_MS}.`,
},
max_output: {
type: 'number',
description: `Max stdout chars. Default ${DEFAULT_MAX_OUTPUT}.`,
type: ['number', 'null'],
description: `Max stdout chars or null. Default ${DEFAULT_MAX_OUTPUT}.`,
},
},
},
invoke: async ({ code, timeout = DEFAULT_TIMEOUT_MS, max_output = DEFAULT_MAX_OUTPUT }) => {
invoke: async ({ code, timeout = DEFAULT_TIMEOUT_MS, max_output = DEFAULT_MAX_OUTPUT, note }) => {
if (typeof code !== 'string' || !code.trim()) {
throw new ToolError('"code" must be a non-empty string.');
}