diff --git a/packages/mcp-server-supabase/src/server.test.ts b/packages/mcp-server-supabase/src/server.test.ts index b411e3f0..0a7c4198 100644 --- a/packages/mcp-server-supabase/src/server.test.ts +++ b/packages/mcp-server-supabase/src/server.test.ts @@ -4050,6 +4050,17 @@ 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'"); + // 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 () => { diff --git a/packages/mcp-server-supabase/src/tools/debugging-tools.ts b/packages/mcp-server-supabase/src/tools/debugging-tools.ts index 5b5b45bb..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', 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 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',