Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(self-hosted): local AI assistant unable to read schemas and interpret/execute SQL (#44757)

Manuel Rubio667be5098218
diff --git a/apps/studio/lib/ai/tools/fallback-tools.ts b/apps/studio/lib/ai/tools/fallback-tools.ts
index 6e02bdbe5e1..7956b8628b2 100644
--- a/apps/studio/lib/ai/tools/fallback-tools.ts
+++ b/apps/studio/lib/ai/tools/fallback-tools.ts
@@ -37,7 +37,7 @@ export const getFallbackTools = ({
}),
execute: async ({ schemas }) => {
try {
- const result = includeSchemaMetadata
+ const { result } = includeSchemaMetadata
? await executeSql(
{
projectRef,
diff --git a/apps/studio/lib/ai/tools/studio-tools.ts b/apps/studio/lib/ai/tools/studio-tools.ts
index 8034025fad9..1279e3f12a3 100644
--- a/apps/studio/lib/ai/tools/studio-tools.ts
+++ b/apps/studio/lib/ai/tools/studio-tools.ts
@@ -35,6 +35,7 @@ export const getStudioTools = () => ({
.describe('Chart configuration for rendering the results'),
isWriteQuery: z
.boolean()
+ .default(false)
.describe(
'Whether the SQL statement performs a write operation of any kind instead of a read operation'
),