Skip to content

Commit 825401f

Browse files
committed
-
1 parent b4cd7e4 commit 825401f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/tool-writer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ const ToolWriter = {
1616
const { logger, Errors } = Utils;
1717

1818
const validateCode = (code) => {
19+
// Check if code is provided
20+
if (!code || typeof code !== 'string') {
21+
throw new Errors.ValidationError('Missing or invalid code parameter. create_tool requires { name, code } where code is the tool implementation.');
22+
}
1923
// Basic sanity check
2024
if (!code.includes('export default') || !code.includes('async function')) {
2125
throw new Errors.ValidationError('Tool must export a default async function');

0 commit comments

Comments
 (0)