From 6ea04685db3e0bfbb6a32b3d413a48e24021ea35 Mon Sep 17 00:00:00 2001 From: Dima <55917062+Rjabov@users.noreply.github.com> Date: Mon, 24 Aug 2026 20:45:55 +0300 Subject: [PATCH 1/5] fix: name function_logs in the ClickHouse query_logs hint --- packages/mcp-server-supabase/src/tools/debugging-tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mcp-server-supabase/src/tools/debugging-tools.ts b/packages/mcp-server-supabase/src/tools/debugging-tools.ts index 5b5b45bb..1cfdbebe 100644 --- a/packages/mcp-server-supabase/src/tools/debugging-tools.ts +++ b/packages/mcp-server-supabase/src/tools/debugging-tools.ts @@ -97,7 +97,7 @@ const queryLogsByDialect = { name: 'ClickHouse', logsNoun: 'unified logs stream', schemaHint: - "Logs are exposed through a `logs` table; filter by `source` (common values include 'edge_logs', 'postgres_logs', and 'function_edge_logs', but this list is not exhaustive — run `select distinct source from logs` to discover the sources available for this project) and read nested fields via `log_attributes['']`.", + "Logs are exposed through a `logs` table; filter by `source` (common values include 'edge_logs', 'postgres_logs', 'function_edge_logs' for Edge Function invocation/request logs, and 'function_logs' for console output from inside an Edge Function, but this list is not exhaustive — run `select distinct source from logs` to discover the sources available for this project) and read nested fields via `log_attributes['']`.", }), bigquery: buildQueryLogsCopy({ name: 'BigQuery', From 50051bdb3ca3e5fa0bbd5a9c9477786c5acd98e8 Mon Sep 17 00:00:00 2001 From: Dima <55917062+Rjabov@users.noreply.github.com> Date: Mon, 24 Aug 2026 20:51:34 +0300 Subject: [PATCH 2/5] test: assert both Edge Function log sources are named in the ClickHouse hint Add assertions for ClickHouse log sources in tests --- packages/mcp-server-supabase/src/server.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/mcp-server-supabase/src/server.test.ts b/packages/mcp-server-supabase/src/server.test.ts index b411e3f0..d4ebfa63 100644 --- a/packages/mcp-server-supabase/src/server.test.ts +++ b/packages/mcp-server-supabase/src/server.test.ts @@ -4050,6 +4050,12 @@ describe('feature groups', () => { expect(queryLogs?.description).toContain('ClickHouse'); expect(sqlDescription).toContain("log_attributes['']"); + // Edge Function logs are split across two ClickHouse sources. The hint must + // name both, or the model reaches for `function_edge_logs` (the request + // envelope) when the user asked for console output, which only lives in + // `function_logs`. See getClickHouseLogQuery in logs.ts. + expect(sqlDescription).toContain("'function_edge_logs'"); + expect(sqlDescription).toContain("'function_logs'"); }); test('query_logs advertises the BigQuery dialect when the platform declares it', async () => { From a7a8ef4998136f0c8f99e8bf3995618d6c009bfe Mon Sep 17 00:00:00 2001 From: Dima <55917062+Rjabov@users.noreply.github.com> Date: Tue, 25 Aug 2026 13:27:14 +0300 Subject: [PATCH 3/5] fix: point the query_logs hint at event_message for log line text Updated the schemaHint for ClickHouse logs to include additional details on reading log line text and per-row metadata. --- packages/mcp-server-supabase/src/tools/debugging-tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mcp-server-supabase/src/tools/debugging-tools.ts b/packages/mcp-server-supabase/src/tools/debugging-tools.ts index 1cfdbebe..d64782f1 100644 --- a/packages/mcp-server-supabase/src/tools/debugging-tools.ts +++ b/packages/mcp-server-supabase/src/tools/debugging-tools.ts @@ -97,7 +97,7 @@ const queryLogsByDialect = { name: 'ClickHouse', logsNoun: 'unified logs stream', schemaHint: - "Logs are exposed through a `logs` table; filter by `source` (common values include 'edge_logs', 'postgres_logs', 'function_edge_logs' for Edge Function invocation/request logs, and 'function_logs' for console output from inside an Edge Function, but this list is not exhaustive — run `select distinct source from logs` to discover the sources available for this project) and read nested fields via `log_attributes['']`.", + "Logs are exposed through a `logs` table; filter by `source` (common values include 'edge_logs', 'postgres_logs', 'function_edge_logs' for Edge Function invocation/request logs, and 'function_logs' for console output from inside an Edge Function, but this list is not exhaustive — run `select distinct source from logs` to discover the sources available for this project) and read the log line text from `event_message` (the console output or message body); `log_attributes['']` holds only per-row metadata such as level, execution_id and status code.", }), bigquery: buildQueryLogsCopy({ name: 'BigQuery', From 47bd01391e13ae13383cdb82f44cfeb7d07ab7a2 Mon Sep 17 00:00:00 2001 From: Dima <55917062+Rjabov@users.noreply.github.com> Date: Tue, 25 Aug 2026 13:31:25 +0300 Subject: [PATCH 4/5] test: assert the ClickHouse hint names event_message Add expectation for event_message in SQL description test --- packages/mcp-server-supabase/src/server.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/mcp-server-supabase/src/server.test.ts b/packages/mcp-server-supabase/src/server.test.ts index d4ebfa63..0a7c4198 100644 --- a/packages/mcp-server-supabase/src/server.test.ts +++ b/packages/mcp-server-supabase/src/server.test.ts @@ -4056,6 +4056,11 @@ describe('feature groups', () => { // `function_logs`. See getClickHouseLogQuery in logs.ts. expect(sqlDescription).toContain("'function_edge_logs'"); expect(sqlDescription).toContain("'function_logs'"); + // The log line text lives in `event_message`; `log_attributes` carries only + // per-row metadata. Without naming the column the model reads + // `log_attributes`, finds no message key, and reports that the console + // output was never stored. See getClickHouseLogQuery in logs.ts. + expect(sqlDescription).toContain('event_message'); }); test('query_logs advertises the BigQuery dialect when the platform declares it', async () => { From 104a789cd5e328405864a6c322aa708df20b4cf9 Mon Sep 17 00:00:00 2001 From: Dima <55917062+Rjabov@users.noreply.github.com> Date: Tue, 25 Aug 2026 13:37:04 +0300 Subject: [PATCH 5/5] style: fix indentation on the ClickHouse schemaHint --- packages/mcp-server-supabase/src/tools/debugging-tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mcp-server-supabase/src/tools/debugging-tools.ts b/packages/mcp-server-supabase/src/tools/debugging-tools.ts index d64782f1..c2839c67 100644 --- a/packages/mcp-server-supabase/src/tools/debugging-tools.ts +++ b/packages/mcp-server-supabase/src/tools/debugging-tools.ts @@ -97,7 +97,7 @@ const queryLogsByDialect = { name: 'ClickHouse', logsNoun: 'unified logs stream', schemaHint: - "Logs are exposed through a `logs` table; filter by `source` (common values include 'edge_logs', 'postgres_logs', 'function_edge_logs' for Edge Function invocation/request logs, and 'function_logs' for console output from inside an Edge Function, but this list is not exhaustive — run `select distinct source from logs` to discover the sources available for this project) and read the log line text from `event_message` (the console output or message body); `log_attributes['']` holds only per-row metadata such as level, execution_id and status code.", + "Logs are exposed through a `logs` table; filter by `source` (common values include 'edge_logs', 'postgres_logs', 'function_edge_logs' for Edge Function invocation/request logs, and 'function_logs' for console output from inside an Edge Function, but this list is not exhaustive — run `select distinct source from logs` to discover the sources available for this project) and read the log line text from `event_message` (the console output or message body); `log_attributes['']` holds only per-row metadata such as level, execution_id and status code.", }), bigquery: buildQueryLogsCopy({ name: 'BigQuery',