Skip to content

fix(mcp): Expose connection-aware destination loading schemas - #1430

Merged
Aaron ("AJ") Steers (aaronsteers) merged 3 commits into
release-candidate/v1from
devin/1793208519-mcp-destination-schema-hints
Oct 30, 2026
Merged

Aaron ("AJ") Steers (aaronsteers) merged 3 commits into
release-candidate/v1from
devin/1793208519-mcp-destination-schema-hints

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

TL;DR: Teach agents that a connection’s loading schema can differ from the destination’s default query context, and expose those overrides in destination guidance.

Updates execute_external_sql_query, describe_connector, and the existing connector-doc namespace inference path rather than introducing a second inference mechanism.

Pairs with:

Validation gap

The single Cloud MCP eval run tested initial commit 57cc1b7: 0 passed, 125 startup errors, zero agent tool calls. Scenarios still require names such as list_cloud_connections, but the server exposes list_connections; the rename is already present in this PR’s RC merge base. The harness rejects its allowed-tool list before invoking any model. This provides no behavioral verdict on the change. No rerun was performed; follow-up transport/quoting fixes are covered by the local regressions below.

Changes

  • Explain database/schema/table naming: BigQuery project/dataset/table; Snowflake database/schema/table. Generate project/database-qualified table examples when configuration is known, using Snowflake identifier escaping.
  • Enrich server-served destination overviews with per-connection loading schema overrides and table prefixes, reusing existing connection metadata. Section-scoped server docs remain unchanged.
  • Keep source-derived namespaces and custom templates advisory; unresolved templates are not returned as concrete destination_schema values.
  • Clarify that loading hints are neither exhaustive inventory nor authorization boundaries. Preserve server docs with a visible warning when connection hints cannot be fetched, including Cloud API and transport failures.

Deployment dependency

The SHOW DATABASES/SHOW TABLES guidance describes the three-part behavior from Sonar #7156; deploy that backend change before releasing this companion. This does not advertise the explicit-context syntax from #7159.

Test plan

  • uv run pytest tests/unit_tests/test_cloud_describe.py tests/unit_tests/test_mcp_cloud.py -q: 264 passed.
  • uv run ruff check airbyte/_direct_connectors/connector_docs.py airbyte/mcp/cloud.py tests/unit_tests/test_cloud_describe.py: passed; formatter applied.
  • uv run pyrefly check: 0 errors (73 suppressed).
  • Repository uv run poe check: passed (exit 0).
  • No customer credentials or live customer queries used.

Link to Devin session: https://app.devin.ai/sessions/c9b53cf95fa34cf699ed1779f3eb3b45
Open in Devin Desktop: https://app.devin.ai/desktop/session/c9b53cf95fa34cf699ed1779f3eb3b45?variant=devin
Requested by: Aaron ("AJ") Steers (@aaronsteers)

Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1793208519-mcp-destination-schema-hints' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1793208519-mcp-destination-schema-hints'

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /uv-lock - Updates uv.lock file
  • /test-pr - Runs tests with the updated PyAirbyte
  • /prerelease - Builds and publishes a prerelease version to PyPI
  • /evals - Runs the Cloud MCP evals that use the MCP tools this PR changed (/evals full=true runs the full suite)
📚 Show Repo Guidance

Helpful Resources

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A timeout or connection failure in the raw-JSON fallback escapes the handler, discarding the successfully fetched server overview instead of preserving it with a warning.

1 open issue
What changed in this PR

This PR makes destination guidance connection-aware, helping agents distinguish sync loading schemas from the default SQL query context.

Changes:

  • Add connection namespace overrides and table prefixes to destination overviews, keeping unresolved templates advisory.
  • Clarify three-part table naming and generate qualified SQL examples when configuration is available.
  • Add tests for loading hints, qualified examples, and server-doc preservation when connection lookup raises a Cloud error.
File Description
tests/​unit_tests/​test_cloud_describe.py Tests connection-aware guidance, SQL examples, and lookup-failure handling.
airbyte/​mcp/​cloud.py Clarifies loading hints and SQL discovery in tool descriptions.
airbyte/​_direct_connectors/​connector_docs.py Enriches destination overviews and refines namespace inference and table examples.

Review effort: Balanced

@github-code-quality

github-code-quality Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: Python

Python / code-coverage/pytest-no-creds

release-candidate/v1 d9f652f devin/1793208519-mcp... c6d665f +/-
65% 80% +15%
View coverage of the 10 most impacted files.
File release-candidate/v1 d9f652f devin/1793208519-mcp... c6d665f +/-
airbyte/_util/api_util.py 36% 67% +31%
airbyte/mcp/cloud.py 52% 86% +34%
airbyte/cloud/connectors.py 34% 79% +45%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/_telemetry.py 0% 94% +94%
airbyte/cloud/c...lder/project.py 0% 94% +94%
airbyte/_direct...ctors/models.py 0% 95% +95%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 97% +97%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest

release-candidate/v1 d9f652f devin/1793208519-mcp... c6d665f +/-
71% 82% +11%
View coverage of the 10 most impacted files.
File release-candidate/v1 d9f652f devin/1793208519-mcp... c6d665f +/-
airbyte/cloud/connectors.py 51% 82% +31%
airbyte/mcp/cloud.py 52% 86% +34%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/_user_identity.py 0% 93% +93%
airbyte/mcp/_telemetry.py 0% 94% +94%
airbyte/cloud/c...lder/project.py 0% 94% +94%
airbyte/_direct...ctors/models.py 0% 95% +95%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 97% +97%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest-unit

release-candidate/v1 devin/1793208519-mcp... c6d665f +/-
— 77% —

Line coverage data for the release-candidate/v1 branch is not yet available.

View coverage of the 10 most covered files.
File release-candidate/v1 devin/1793208519-mcp... c6d665f +/-
airbyte/cloud/models.py — 97% —
airbyte/mcp/_sso_auth.py — 96% —
airbyte/_direct...ctors/models.py — 95% —
airbyte/cloud/client.py — 90% —
airbyte/exceptions.py — 90% —
airbyte/mcp/cloud.py — 86% —
airbyte/progress.py — 80% —
airbyte/cloud/connectors.py — 79% —
airbyte/shared/...ql_processor.py — 68% —
airbyte/_util/api_util.py — 67% —

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 28, 2026 18:15 UTC

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Generated Snowflake examples insert database names without proper identifier quoting, producing invalid SQL for valid names containing special characters.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Quote Snowflake database identifiers with special characters

airbyte/​_direct_connectors/​connector_docs.py:367

Adding the database verbatim produces invalid examples for valid Snowflake database names that require quoting. For example, database="ANALYTICS-PROD" and schema="RAW" now generate SELECT * FROM ANALYTICS-PROD.RAW.<table> LIMIT 10; the database component must be quoted as a single identifier. Please apply Snowflake-aware identifier quoting/escaping to the newly added database component and cover a special-character database name in the example tests.

1 resolved since last review

Review effort: Balanced

@devin-ai-integration

Copy link
Copy Markdown
Contributor

On it. The newly added database qualifier needs escaping when the configured Snowflake identifier contains special characters, as noted in the latest review. I’m correcting the example formatting and adding regressions without changing ordinary unquoted-name resolution.

Written by Devin, as requested by Aaron ("AJ") Steers (@aaronsteers).

Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

Resolved in c6d665f. Addressed the Snowflake example review with the existing Snowflake SQLAlchemy identifier preparer, not a new quoting implementation. Regressions cover hyphens, embedded dots, escaped quotes, reserved words, and ordinary lowercase names. All 264 focused tests and repository poe check pass.

Written by Devin, as requested by Aaron ("AJ") Steers (@aaronsteers).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The SQL discovery guidance depends on inaccessible Sonar #7156, so its SHOW DATABASES/SHOW TABLES contract and required deployment order need human verification.

No open issues 🎉

Review effort: Balanced

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Verified; rollout dependency retained. In response to the cross-repo review, I checked the Sonar provider implementations and their tests locally: SHOW DATABASES identifies the configured BigQuery project/Snowflake database, while SHOW TABLES spans that context’s schemas (BigQuery remains query-location-scoped). Ordinary query defaults are unchanged.

As the description states, deploy Sonar #7156 before releasing this companion. Sonar #7159 is optional for this PR: the MCP guidance does not advertise its explicit-context syntax. No additional behavior change is needed here.

Written by Devin, as requested by Aaron ("AJ") Steers (@aaronsteers).

@aaronsteers

Copy link
Copy Markdown
Member Author

Devin, does this depend on other PRs merging first?

@devin-ai-integration

devin-ai-integration Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Hola, AJ. No remaining Sonar merge/deployment dependency. In answer to your question:

  • Sonar #7156 is merged and its production backend is deployed. Read-only validation through the official PyAirbyte → Cloud → Sonar path confirmed the intended BigQuery project/database inventory, cross-dataset table discovery, and preserved default query context. Serving-release logs confirm the new version handled those checks.
  • Sonar #7159 is not required: this PR does not advertise its explicit IN DATABASE / IN SCHEMA syntax.

The Cloud MCP eval-harness follow-up remains separate and nonblocking, as agreed. Snowflake live validation remains untested because SQL passthrough is disabled in the authorized test setup; no configuration was changed.

Separate existing pagination-contract issue found during validation: the SQL tool exposes page_size, but it was ignored by the backend SQL request model. Backend response caps still apply. That follow-up is outside these PRs.

Written by Devin, as requested by Aaron ("AJ") Steers (@aaronsteers).

@aaronsteers
Aaron ("AJ") Steers (aaronsteers) merged commit 91613cf into release-candidate/v1 Oct 30, 2026
32 checks passed
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) deleted the devin/1793208519-mcp-destination-schema-hints branch October 30, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants