Skip to content

Commit 24a84f1

Browse files
Fix tool wrapper in skills load
Refined skill tools loading to ensure each tool has a proper type wrapper ('function'), preventing AI tool-definition errors during reasoning. Updated mapping to auto-add type if missing. X-Lovable-Edit-ID: edt-c56420cd-5739-4a7e-918a-0a9b61d1a695 Co-authored-by: magnusfroste <38864257+magnusfroste@users.noreply.github.com>
2 parents c9c4b65 + aa69c54 commit 24a84f1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

supabase/functions/_shared/agent-reason.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,12 @@ export async function loadSkillTools(supabase: any, scope: 'internal' | 'externa
17801780

17811781
return (skills || [])
17821782
.filter((s: any) => s.tool_definition?.function)
1783-
.map((s: any) => s.tool_definition);
1783+
.map((s: any) => {
1784+
const td = s.tool_definition;
1785+
// Ensure every tool has the required 'type' field
1786+
if (!td.type) td.type = 'function';
1787+
return td;
1788+
});
17841789
}
17851790

17861791
// ─── Non-Streaming Reason Loop ────────────────────────────────────────────────

0 commit comments

Comments
 (0)