Repository navigation
fix: Add sourceId to MCP Raw SQL Tile schema - #2424
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: d234b4b The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔴 Tier 4 — CriticalTouches auth, data models, config, tasks, OTel pipeline, ClickHouse, or CI/CD. Why this tier:
Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge — the changes are additive and well-tested; the new validation guard only rejects configurations that would silently misbehave at render time. The new sourceId field is optional in the schema and the existing save/patch paths were already converting it to the internal source field. The validation guard is defensive-only: it fires exclusively when a tile uses a macro that requires a source but omits sourceId, a case that was previously a silent failure. The constant, helper functions, and calling code are all covered by unit and integration tests. No pre-existing behaviour is altered for tiles that don't use source-dependent macros. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[MCP Tool Input\nsave / update / patch] --> B[Zod Schema Parse\nmcpSqlTileSchema includes sourceId]
B -->|invalid| C[Return schema error]
B -->|valid| D[getRawSqlMissingSourceError]
D --> E{SQL tile uses\n$__filters or\n$__sourceTable?}
E -->|No / sourceId set| F[validateDashboardTiles\nexisting validator]
E -->|Yes, no sourceId| G[Return mcpError\nnaming tile + macros]
F -->|invalid| H[Return validation error]
F -->|valid| I[convertExternalTilesToInternal\nsourceId to source field]
I --> J[Save to MongoDB\nsource ObjectId stored]
Reviews (3): Last reviewed commit: "Merge branch 'main' into drew/improve-mc..." | Re-trigger Greptile |
Deep Review✅ No critical issues found. The change is small, additive, and well-tested. 🟡 P2 -- recommended
🔵 P3 nitpicks (5)
Reviewers (8): correctness, testing, maintainability, project-standards, api-contract, kieran-typescript, agent-native, learnings-researcher. Testing gaps: |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
E2E Test Results✅ All tests passed • 198 passed • 3 skipped • 1355s
Tests ran across 4 shards in parallel. |
Summary
This PR updates the MCP server's dashboard schemas/prompts to allow agents to set source ID for raw sql chart configs. This is required for certain macros to work.
Screenshots or video
Claude now generates dashboards with Raw SQL Tiles with the Source ID set:
How to test on Vercel preview
This can be tested locally by asking your agent to generate a dashboard with some Raw SQL Tiles.
References