Skip to content

feat(mcp): add typed Airbyte Agents entity tools - #1132

Draft
Aaron ("AJ") Steers (aaronsteers) wants to merge 2 commits into
mainfrom
devin/1787878218-agents-entity-tools
Draft

feat(mcp): add typed Airbyte Agents entity tools#1132
Aaron ("AJ") Steers (aaronsteers) wants to merge 2 commits into
mainfrom
devin/1787878218-agents-entity-tools

Conversation

@aaronsteers

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

Copy link
Copy Markdown
Member

Summary

Requested by AJ Steers as the follow-up to the merged Agents base work (#1127), which shipped the generic pair execute_agent_connector_ro / execute_agent_connector. Those two are enough to reach any connector action, but they push two costs onto the calling agent: it has to know the action vocabulary, and it gets back result: Any with no shape.

This adds six action-specific MCP tools in a new airbyte/mcp/agents_entities.py, all thin presentation over the same hidden _execute() helper the generic tools use — no new transport, no new auth path, no change to airbyte/agents/.

# read, annotated read_only=True idempotent=True, so they survive readonly mode
list_agent_entities(...)   -> AgentEntityPageResult   # action="list"
search_agent_entities(..., use_api_search=False) -> AgentEntityPageResult  # "search" | "api_search"
get_agent_entity(...)      -> AgentEntityResult      # action="get"

# write
create_agent_entity(...)   -> AgentWriteResult
update_agent_entity(...)   -> AgentWriteResult
delete_agent_entity(...)   -> AgentWriteResult       # destructive=True

Two things this buys beyond naming:

  1. Readonly mode gets real reads. readOnlyHint is a static annotation read by the server's readonly filter before any call, so the generic write-capable tool vanishes whole in readonly mode. The three read tools here are statically read-only, so a readonly deployment can still list, search, and get.
  2. Typed returns instead of Any. The generic result carries result: Any; these return the shape the action actually produces — a page (entities, has_next_page, end_cursor), a single entity | None, or a write ack. Coercion is strict rather than permissive: get_agent_entity raises PyAirbyteInputError if the connector returns more than one entity, and any non-object payload is rejected rather than passed through as a mystery blob.

entity_type stays a free string, since inspect publishes only Context Store entities, not everything execute() accepts — typing it would reject legitimate calls.

Deliberately not done: no seventh tool for api_search (same read shape as search, so it's a use_api_search flag), and no separate record/fields argument on the writes — the payload stays in api_args, which is where the connector-specific arguments already live.

workspace_id behaves exactly as in the generic tools: exposed as an argument, hidden when statically configured, and the connector is resolved through its workspace so a connector belonging to another workspace is rejected before any action runs.

Test Plan

  • uv run pytest tests/unit_tests/test_mcp_agent_entities.py tests/unit_tests/test_mcp_agents.py — 13 new cases, 43 total, passing. Covers page shaping and cursor passthrough, the use_api_search action switch, all six coercion outcomes for get_agent_entity (including the multi-match and non-object rejections), per-tool action/payload forwarding on the writes, and a live-server assertion that the read tools register with readOnlyHint=true and delete_agent_entity with destructiveHint=true.
  • uv run ruff format / uv run ruff check / uv run pyrefly check clean.
  • uv run poe mcp-docs-md regenerates cleanly and emits docs/mcp-generated/agents_entities.md (gitignored, generated at build time).
  • Live Agents execution is not exercised here; as in feat(cloud): add Airbyte Agents support in PyAirbyte and cloud-mcp: execute API and MCP tools, AgentOrganization, and AgentWorkspace #1127 there are no cassettes for the Agents API.

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

Summary by CodeRabbit

  • New Features

    • Added Airbyte Agents entity tools for listing, searching, viewing, creating, updating, and deleting entities.
    • Added pagination, field selection, excluded-field filtering, search options, and workspace-aware configuration.
    • Registered the new tools with the MCP server, including clear status and warning information in results.
  • Tests

    • Added coverage for entity retrieval, pagination, search handling, payload validation, write operations, and server registration.

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

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review August 28, 2026 00:55
Copilot AI lite review requested due to automatic review settings August 28, 2026 00:55
@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/1787878218-agents-entity-tools' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1787878218-agents-entity-tools'

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
📚 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: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

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.

Pull request overview

Adds a dedicated set of typed MCP tools for Airbyte Agents “entity” operations (list/search/get + create/update/delete), providing stricter result shaping and tool-level readonly/destructive hints, and wires them into the MCP server with unit coverage.

Changes:

  • Added airbyte/mcp/agents_entities.py implementing six entity-specific MCP tools with typed return models and strict payload coercion.
  • Registered the new toolset in the MCP server so it appears in the tool list (including readonly/destructive annotations).
  • Added unit tests covering paging shape, search action selection, get coercion/rejection cases, write forwarding, and tool annotations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
airbyte/mcp/agents_entities.py New typed entity MCP tools and result models; registration helper for server integration.
airbyte/mcp/server.py Registers the new entity tool module with the FastMCP app.
airbyte/mcp/__init__.py Exposes agents_entities as part of the public airbyte.mcp module exports.
tests/unit_tests/test_mcp_agent_entities.py New unit tests validating typed tool behavior, coercion rules, forwarding, and annotations.
Suppressed comments (2)

airbyte/mcp/agents_entities.py:339

  • search_agent_entities currently hard-codes exclude_fields=None, so callers cannot actually use the field-exclusion capability that _execute() already supports.
        action="api_search" if use_api_search else "search",
        api_args=api_args,
        select_fields=select_fields,
        exclude_fields=None,
        page_size=page_size,

airbyte/mcp/agents_entities.py:397

  • get_agent_entity currently hard-codes exclude_fields=None, so even after adding the parameter it needs to be forwarded into _execute() for it to take effect.
        action="get",
        api_args=api_args,
        select_fields=select_fields,
        exclude_fields=None,
        page_size=None,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread airbyte/mcp/agents_entities.py
Comment thread airbyte/mcp/agents_entities.py
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 957c1ad7-be9a-4e3d-9acd-4e1bf53a38bf

📥 Commits

Reviewing files that changed from the base of the PR and between 8f5b907 and f32b5a2.

📒 Files selected for processing (2)
  • airbyte/mcp/agents_entities.py
  • tests/unit_tests/test_mcp_agent_entities.py

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Changes

Agent entity operations

Layer / File(s) Summary
Entity contracts and execution helpers
airbyte/mcp/agents_entities.py
Adds typed page, single-entity, and write results. Adds payload coercion and shared read/write execution helpers.
Entity operation tools
airbyte/mcp/agents_entities.py, tests/unit_tests/test_mcp_agent_entities.py
Adds list, search, get, create, update, and delete tools. Tests validate action selection, argument forwarding, pagination, result shaping, and invalid payload handling.
Server registration and validation
airbyte/mcp/__init__.py, airbyte/mcp/server.py, airbyte/mcp/agents_entities.py, tests/unit_tests/test_mcp_agent_entities.py
Exports and registers the new tools. Applies workspace defaults when configured. Tests validate read-only, writable, and destructive annotations.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to f32b5

The PR adds typed Agent entity tools while preserving existing workspace, authentication, readonly, and connector execution controls. No actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant MCPClient
  participant EntityTool
  participant ReadWriteHelper
  participant Execute
  participant AgentConnector
  MCPClient->>EntityTool: invoke entity operation
  EntityTool->>ReadWriteHelper: pass action and arguments
  ReadWriteHelper->>Execute: execute Agent action
  Execute->>AgentConnector: forward connector request
  AgentConnector-->>Execute: return action result
  Execute-->>ReadWriteHelper: return status and payload
  ReadWriteHelper-->>EntityTool: shape entity result
  EntityTool-->>MCPClient: return MCP result
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 4 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding typed Airbyte Agents entity tools to MCP.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch devin/1787878218-agents-entity-tools

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest-fast

The overall line coverage in commit f32b5a2 in the devin/1787878218-age... branch is 71%. The line coverage in commit d9f652f in the main branch is 65%.

Show a line coverage summary of the most impacted files.
File main d9f652f devin/1787878218-age... f32b5a2 +/-
airbyte/agents/_api_util.py 0% 86% +86%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/agents/...rganizations.py 0% 93% +93%
airbyte/mcp/agents.py 0% 94% +94%
airbyte/cloud/models.py 0% 95% +95%
airbyte/mcp/http_main.py 0% 95% +95%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%
airbyte/agents/models.py 0% 99% +99%
airbyte/mcp/agents_entities.py 0% 99% +99%
airbyte/agents/connectors.py 0% 100% +100%

Python / code-coverage/pytest-no-creds

The overall line coverage in commit f32b5a2 in the devin/1787878218-age... branch is 70%. The line coverage in commit d9f652f in the main branch is 65%.

Show a line coverage summary of the most impacted files.
File main d9f652f devin/1787878218-age... f32b5a2 +/-
airbyte/agents/_api_util.py 0% 86% +86%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/agents/...rganizations.py 0% 93% +93%
airbyte/mcp/agents.py 0% 94% +94%
airbyte/cloud/models.py 0% 95% +95%
airbyte/mcp/http_main.py 0% 95% +95%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%
airbyte/agents/models.py 0% 99% +99%
airbyte/mcp/agents_entities.py 0% 99% +99%
airbyte/agents/connectors.py 0% 100% +100%

Python / code-coverage/pytest

The overall line coverage in commit f32b5a2 in the devin/1787878218-age... branch is 75%. The line coverage in commit d9f652f in the main branch is 71%.

Show a line coverage summary of the most impacted files.
File main d9f652f devin/1787878218-age... f32b5a2 +/-
airbyte/agents/_api_util.py 0% 86% +86%
airbyte/mcp/int..._registry_ui.py 0% 92% +92%
airbyte/agents/...rganizations.py 0% 93% +93%
airbyte/mcp/agents.py 0% 94% +94%
airbyte/cloud/models.py 0% 95% +95%
airbyte/mcp/http_main.py 0% 95% +95%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%
airbyte/agents/models.py 0% 99% +99%
airbyte/mcp/agents_entities.py 0% 99% +99%
airbyte/agents/connectors.py 0% 100% +100%

Updated August 28, 2026 01:26 UTC

@devin-ai-integration
devin-ai-integration Bot marked this pull request as draft August 28, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants