Skip to content

feat(mcp): Add test-my-tools prompt with optional scope parameter#893

Merged
Aaron ("AJ") Steers (aaronsteers) merged 3 commits into
mainfrom
devin/1764959378-add-test-tools-prompt
Dec 5, 2025
Merged

feat(mcp): Add test-my-tools prompt with optional scope parameter#893
Aaron ("AJ") Steers (aaronsteers) merged 3 commits into
mainfrom
devin/1764959378-add-test-tools-prompt

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Dec 5, 2025

Copy link
Copy Markdown
Member

Summary

Adds a new test-my-tools MCP prompt that instructs an agent to systematically test all available tools in the PyAirbyte MCP server. This replicates the pattern from Airbyte Ops MCP with a PyAirbyte-specific enhancement: an optional scope parameter that allows focusing tests on specific tool domains.

Changes:

  • New airbyte/mcp/prompts.py module with TEST_MY_TOOLS_GUIDANCE and scope-specific guidance
  • test_my_tools_prompt() function with optional scope parameter accepting 'registry', 'local', or 'cloud'
  • Registration of prompts in server.py

Updates since last revision

Per reviewer feedback:

  • Simplified guidance text: Removed all tool-specific testing instructions to keep the prompt minimal. The guidance now provides general testing principles without prescribing specific tools to test.
  • Moved function to module level: The test_my_tools_prompt() function is now defined at module level instead of nested inside register_prompts(), following the pattern used elsewhere in the codebase.
  • Simplified scope guidance: Scope-specific guidance is now a single sentence per scope rather than detailed tool lists.

Review & Testing Checklist for Human

  • Test the prompt is accessible via an MCP client (e.g., Claude Desktop) by invoking the "test-my-tools" prompt
  • Test the scope parameter works correctly with values 'registry', 'local', and 'cloud'
  • Verify the prompt registration pattern (app.prompt(...)(function)) works correctly with FastMCP

Recommended test plan: Connect to the PyAirbyte MCP server via Claude Desktop or another MCP client, invoke the "test-my-tools" prompt with and without the scope parameter, and verify it returns the expected guidance text.

Notes

Summary by CodeRabbit

  • New Features
    • Added a "test-my-tools" prompt delivering comprehensive, multi-section guidance for testing MCP tools.
    • Supports optional scope to tailor guidance (e.g., registry, local, cloud) for focused test runs.
    • Prompt integrated into MCP server startup and includes environment and reporting guidance for test executions.

✏️ Tip: You can customize this high-level summary in your review settings.

Important

Auto-merge enabled.

This PR is set to merge automatically when all requirements are met.

@devin-ai-integration

Copy link
Copy Markdown
Contributor
Original prompt from AJ Steers
Received message in Slack channel #ask-devin-ai:

@Devin - Investigate the new "test-tools" prompt in Airbyte Ops MCP. Create a pair of PRs to repeat this pattern in Connector Builder MCP and PyAirbyte MCP? In PyAirbyte, we'll need an optional prompt input like 'scope' that will (optionally) focus tests further than just "test everything".
Thread URL: https://airbytehq-team.slack.com/archives/C08BHPUMEPJ/p1764958740107279

@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 and CI monitoring

@github-actions

github-actions Bot commented Dec 5, 2025

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

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/1764959378-add-test-tools-prompt' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1764959378-add-test-tools-prompt'

Helpful Resources

PR Slash Commands

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

  • /fix-pr - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test-pr - Runs tests with the updated PyAirbyte

Community Support

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

📝 Edit this welcome message.

@coderabbitai

coderabbitai Bot commented Dec 5, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a new MCP prompts module defining long-form testing guidance and a scope-aware prompt generator, and registers a "test-my-tools" prompt with the FastMCP MCP server during MCP initialization.

Changes

Cohort / File(s) Summary
MCP prompts module
airbyte/mcp/prompts.py
New module introducing TEST_MY_TOOLS_GUIDANCE (long-form guidance), test_my_tools_prompt(scope) which builds prompt content and optionally appends a scope/constraints block, and register_prompts(app: FastMCP) to register the "test-my-tools" prompt with the FastMCP app.
Server initialization
airbyte/mcp/server.py
Imports register_prompts from airbyte.mcp.prompts and calls it during MCP server setup alongside existing component registrations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify test_my_tools_prompt handles None/empty scope and properly escapes or formats appended scope text.
  • Confirm register_prompts registers name, description, and handler signature with the FastMCP app the same way other prompt registrations are done.
  • Check TEST_MY_TOOLS_GUIDANCE formatting for any quoting/whitespace issues when consumed by downstream prompt clients.

Want a minimal unit test sketch for prompt registration and scope behavior? wdyt?

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a new MCP prompt called 'test-my-tools' with an optional scope parameter, which aligns with the core purpose of this PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/1764959378-add-test-tools-prompt

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 and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
airbyte/mcp/prompts.py (2)

108-125: Consider normalizing and validating scope a bit more

Right now you only do scope.lower() and silently ignore invalid values, which means a value like " registry " or "REGISTRY " works only partially (second does, first doesn’t) and totally invalid values just fall back to the generic guidance with no hint. Would it be worth doing something like normalized = scope.strip().lower() plus an explicit check/optional warning or error so callers get clearer feedback when they pass a bad scope, wdyt?


63-93: Tighten up scope guidance string formatting to avoid extra blank lines

Because the scope texts are triple‑quoted without .strip(), they’ll likely include a leading newline and any trailing whitespace when appended to content, which can make the rendered prompt a bit uneven. Would you consider either calling .strip() on scope_text when you pull it from SCOPE_GUIDANCE, or defining these strings with .strip() at declaration time to keep formatting predictable, wdyt?

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9301599 and 4a39c55.

📒 Files selected for processing (2)
  • airbyte/mcp/prompts.py (1 hunks)
  • airbyte/mcp/server.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
airbyte/mcp/server.py (1)
airbyte/mcp/prompts.py (1)
  • register_prompts (96-131)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Pytest (All, Python 3.11, Windows)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Windows)
  • GitHub Check: Pytest (No Creds)
  • GitHub Check: Pytest (Fast)
🔇 Additional comments (1)
airbyte/mcp/server.py (1)

14-26: Registering prompts alongside other MCP tools looks good

Importing register_prompts and wiring it in next to the other register_*_tools calls keeps server setup cohesive and discoverable; I don’t see any issues here. 👍 Wdyt?

@github-actions

github-actions Bot commented Dec 5, 2025

Copy link
Copy Markdown

PyTest Results (Fast Tests Only, No Creds)

348 tests  ±0   348 ✅ ±0   5m 40s ⏱️ -15s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit c6f9320. ± Comparison against base commit 9301599.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Dec 5, 2025

Copy link
Copy Markdown

PyTest Results (Full)

416 tests  ±0   400 ✅ ±0   23m 57s ⏱️ - 4m 17s
  1 suites ±0    16 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit c6f9320. ± Comparison against base commit 9301599.

♻️ This comment has been updated with latest results.

Comment thread airbyte/mcp/prompts.py Outdated
…ule level

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
airbyte/mcp/prompts.py (2)

19-44: Guidance content is clear; do you want to make it more tool‑specific?

The general instructions and scope notes read well. Given the PR checklist mentions validating specific tool names, would it be worth explicitly calling out a few canonical tools in the guidance (e.g., “start by calling the connector registry listing tools, then local, then cloud ones”), so agents are nudged toward the right entrypoints, wdyt? You could also consider slightly expanding the scope strings to mirror the actual domains (e.g., “Connector Registry tools”, “Local PyAirbyte tools”, etc.) for extra clarity.


47-65: Scope parameter: tighten typing and clarify behavior for invalid values?

The optional scope parameter and case‑insensitive lookup look good. Two small improvements you might consider:

  • Would switching the annotation to Literal["registry", "local", "cloud"] | None help make the valid values self‑documenting to type checkers and clients?
  • Right now, an unrecognized scope silently falls back to the “all tools” behavior. Would you prefer to either (a) raise a clear error, or (b) append a short note to the content like “Unknown scope 'foo'; testing all tools instead” so callers get feedback, wdyt?

Neither is strictly required, but they might make the prompt behavior more predictable when mis‑configured.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a39c55 and 8594182.

📒 Files selected for processing (1)
  • airbyte/mcp/prompts.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Pytest (No Creds)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Windows)
  • GitHub Check: Pytest (All, Python 3.11, Windows)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
🔇 Additional comments (1)
airbyte/mcp/prompts.py (1)

74-79: Prompt registration helper looks clean and consistent

Registering test-my-tools via a dedicated register_prompts(app) keeps server setup modular and mirrors the usual FastMCP pattern. I don’t see any issues here from a correctness or design standpoint.

Comment thread airbyte/mcp/prompts.py
…ned values

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
airbyte/mcp/prompts.py (1)

41-52: Consider hinting at common scope examples in the parameter description

The scope parameter is nicely modeled as free‑form text and injected verbatim, which lines up with the earlier requirement. To improve discoverability for common use cases, would it be worth mentioning a few canonical examples (like “registry”, “local”, or “cloud”) directly in the description string so MCP clients surface that guidance in UI tooltips, while still allowing arbitrary text? Something like “…for example: ‘registry’, ‘local’, ‘cloud’, or any other custom scope.” Wdyt?

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8594182 and c6f9320.

📒 Files selected for processing (1)
  • airbyte/mcp/prompts.py (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: yohannj
Repo: airbytehq/PyAirbyte PR: 716
File: airbyte/logs.py:384-402
Timestamp: 2025-07-11T19:53:44.427Z
Learning: In the PyAirbyte project, when reviewing PRs, maintain clear separation of concerns. Don't suggest changes that are outside the scope of the PR's main objective, even if they would improve consistency or fix other issues. This helps with reviewing changes and potential reverts.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Pytest (No Creds)
  • GitHub Check: Pytest (All, Python 3.11, Windows)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Windows)
  • GitHub Check: Pytest (Fast)
🔇 Additional comments (2)
airbyte/mcp/prompts.py (2)

19-38: Guidance text looks clear and safely generic

The guidance here is concise, avoids tool‑specific details, and emphasizes safe, low‑impact testing, which seems exactly right for a shared “test-my-tools” prompt. I don’t see anything I’d tweak in this block.


67-72: Prompt registration pattern looks correct and consistent

Registering test_my_tools_prompt via app.prompt(...)(test_my_tools_prompt) with a clear name and description matches the FastMCP pattern and keeps the wiring nicely centralized in register_prompts. Unless you plan on adding aliases (e.g., a shorter “test-tools” name) I don’t see any changes needed here. Wdyt about leaving it as-is for now?

@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit 69f6c96 into main Dec 5, 2025
24 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the devin/1764959378-add-test-tools-prompt branch December 5, 2025 20:08
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.

1 participant