fix(executor): pass execution context with abortSignal to tool execute()
Some AI SDK tools (like @parallel-web/ai-sdk-tools) expect execute(params, context)
where context contains { abortSignal, messages, toolCallId }. Previously we only
passed params which caused 'Cannot destructure abortSignal' errors.
Also:
- Improved playground system prompt for better tool execution
- Playground /api/tools now proxies to web app with response transformation
- Added broken-tools.md documenting tool failure categories
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1a2128d3ae
commit
0804f1bd1e
4 changed files with 127 additions and 20 deletions
|
|
@ -530,9 +530,18 @@ async function executeTool(req: Request): Promise<Response> {
|
|||
console.log('⚠️ No env object in request body');
|
||||
}
|
||||
|
||||
// Execute the tool
|
||||
// Execute the tool with AI SDK execution context
|
||||
// Some tools expect a second argument with { abortSignal, ... }
|
||||
const abortController = new AbortController();
|
||||
const executionContext = {
|
||||
abortSignal: abortController.signal,
|
||||
// Add other context properties that AI SDK tools might expect
|
||||
messages: [],
|
||||
toolCallId: `exec_${Date.now()}`,
|
||||
};
|
||||
|
||||
console.log(`🚀 Executing ${cacheKey} with params:`, params);
|
||||
const result = await toolModule.execute(params || {});
|
||||
const result = await toolModule.execute(params || {}, executionContext);
|
||||
|
||||
const executionTimeMs = Date.now() - startTime;
|
||||
console.log(`✅ Execution complete in ${executionTimeMs}ms`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue