Repository navigation
Add native SQL query formatting tool - #32
Merged
Merged
Conversation
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.
Add the
query-formatMCP tool andRawTreeClient.formatQuery, using authenticatedPOST /v1/query-formatwithout executing SQL. The tool preserves complete SQL and the full{ "formatted": "..." }response, follows existing organization/cluster/database defaults and explicit-scope mode, validates success response shape, and forwards MCP cancellation to the HTTP request.Example tool arguments:
{ "sql": "select 1; select 'hello'", "organization": "acme", "cluster": "production" }The API accepts 50 MiB JSON requests, 100 MiB formatted output, and a 30-second formatting timeout. Native inline INSERT VALUES data is preserved verbatim without completeness/schema validation. Raise the bundled HTTP (previously 100 KiB) and stdio (previously 10 MiB) request limits to a bounded 51 MiB for the API payload plus MCP envelope. Client/hosting gateway limits can still be smaller; document that boundary.
Bump MCP 0.3.5 → 0.3.6 and add the changelog entry. The frozen pnpm lockfile needs no change because it does not record the root package version. No release is published.
Dependency: Platform #1468, inspected at
397dc652846ad5820073641c19301ea154289cce. Deployment is required; this PR does not establish production endpoint availability.Validation:
pnpm lint,pnpm test(197 passed), andpnpm buildpassed.--mode local --max-priority P3) and thermo-nuclear maintainability review complete; final review has no actionable findings. TruffleHog clean. The earlier empty-SQL finding was rejected against the Platform handler, which explicitly rejects empty/whitespace SQL; corrected review passed.Companion: CLI #82.
Note
Low Risk
Read-only formatting with no SQL execution; main operational change is higher MCP request buffers, which can increase memory use for very large payloads.
Overview
Adds a
query-formatMCP tool andRawTreeClient.formatQuery, calling authenticatedPOST /v1/query-formatto return the full{ "formatted": "..." }payload without executing SQL or writing query logs. Scope follows existing organization/cluster/database defaults and explicit-scope mode; success responses are validated and MCP cancellation is forwarded to the outbound HTTP request via a newAbortSignalon the API client.HTTP and stdio transports now accept MCP requests up to 51 MiB (
MAX_MCP_REQUEST_BYTES) so large SQL can fit under the API’s 50 MiB JSON cap plus MCP envelope overhead. Package version is 0.3.6 with README/changelog updates; tests cover the tool, errors, cancellation, and ~11 MiB round-trips over real HTTP/stdio paths.Requires Platform
POST /v1/query-format(Platform PR #1468).Reviewed by Cursor Bugbot for commit 29bfde7. Bugbot is set up for automated code reviews on this repo. Configure here.