feat: support edge function runtime logs in get_logs#326
Open
barryroodt wants to merge 2 commits into
Open
Conversation
Adds an edge-function-runtime service to get_logs exposing edge function
console output (function_logs), which was previously unreachable via MCP.
Migrates the cloud logs path from the deprecated BigQuery logs.all
endpoint to the ClickHouse /v1/projects/{ref}/analytics/endpoints/logs
endpoint; the BigQuery query builder is retained for self-hosted
deployments, which cannot use the ClickHouse endpoint.
All get_logs output is now wrapped in the same untrusted-data
prompt-injection boundary as execute_sql, via a shared helper.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
gregnr
reviewed
Jul 9, 2026
| get_logs: { | ||
| description: | ||
| 'Gets logs for a Supabase project by service type. Use this to help debug problems with your app. This will return logs within the last 24 hours.', | ||
| 'Gets logs for a Supabase project by service type. Each call returns logs from the last 24 hours. Edge Function logs are split by kind: `edge-function` returns invocation/request logs, while `edge-function-runtime` returns console output from inside the function. Query one service first, then correlate with other services by timestamp or error anchors. Do not poll get_logs in a loop; use Log Drains for streaming logs.', |
Member
There was a problem hiding this comment.
Each call returns logs from the last 24 hours.
Might be worth adding "by default". The agent can specify a custom start/end date (which cap at 24 hours too).
use Log Drains for streaming logs
I understand the sentiment behind this but I don't think this has an easy call to action. Log Drains needs a paid account today, then you need to connect a destination, then you need to feed those logs to the agent somehow, probably via another MCP server or CLI. I think it might be simpler to omit this last part.
Author
There was a problem hiding this comment.
Thanks for the feedback 🙏
Both addressed in 66fd246:
- Description now says the 24h window is the default - and
get_logsnow actually exposes optionaliso_timestamp_start/iso_timestamp_end(the handler previously hardcoded the window even though the platform layer supported custom ranges, so this comment turned a doc tweak into a small feature 🙂). Added a test asserting the params are forwarded to the management API as query params. - Dropped the Log Drains pointer, kept the don't-poll guidance.
Review feedback: expose optional iso_timestamp_start/iso_timestamp_end on get_logs (24h default window unchanged; API caps ranges at 24h) and drop the Log Drains pointer from the tool description while keeping the no-polling guidance. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Coverage Report for CI Build 29079255813Coverage increased (+0.02%) to 96.267%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
get_logsMCP tool only exposes edge function invocation logs (function_edge_logs). Edge function runtime logs —console.logoutput, the dashboard's per-function "Logs" view (function_logs) — are unreachable via MCP. Reported independently by two users in April; confirmed as a gap inlogs.ts(Linear: AI-651).The tool also still queries the deprecated BigQuery
logs.allendpoint (Linear: AI-890 / platform PR supabase/platform#35096 context).Changes
edge-function-runtimeservice onget_logs, returning edge function console output.edge-functionkeeps meaning invocation logs (backward compatible).getLogsnow calls/v1/projects/{ref}/analytics/endpoints/logswith ClickHouse SQL against the unifiedlogstable (newgetClickHouseLogQuerybuilder). The endpoint already exists in the generated management API types — no type regen.getLogQuery, extended with the runtime case) — self-hosted deployments cannot use the ClickHouse endpoint and must keep the legacy path.get_logsoutput is now wrapped in the same UUID-salted<untrusted-data>boundary asexecute_sql, extracted into a sharedwrapWithUntrustedDataBoundaryhelper (log content is arbitrary user text).logs.allhandler kept), service iteration extended, untrusted-data boundary asserted, newlogs.test.tscovering both builders for every service.Notes for reviewers
branch-actionmaps tosource = 'workflow_run_logs'withlog_attributes['workflow_run']— matches platform PR #35096 (source added to the endpoint 2 Jul). It's not yet inshared-data/log-constants.ts; flagged to the observability team to confirm.source = 'edge_logs'for theapiservice (per the ClickHouse logs query reference) where #35096 uses'api', and it does not repurpose the existingedge-functionvalue. Both raised on the Linear tickets.Verification
AI-assisted (Claude + Codex via verified-swarm harness); human-reviewed by @barryroodt. Evidence:
pnpm typecheck— cleanCI=true pnpm test:unit— 182/182 pass (11 files; baseline on main was 164)pnpm format:check(biome) — cleanexecute_sql, API shape/backward compat) — findings adjudicated and folded inLinear: AI-651, AI-890
🤖 Generated with Claude Code