Skip to content

Add Tests for McpApiController Tool Execution#43

Open
Snider wants to merge 4 commits intodevfrom
feat/mcp-api-tests-8082099650712094462
Open

Add Tests for McpApiController Tool Execution#43
Snider wants to merge 4 commits intodevfrom
feat/mcp-api-tests-8082099650712094462

Conversation

@Snider
Copy link
Contributor

@Snider Snider commented Feb 4, 2026

Added a new test file src/Api/Tests/Feature/McpApiControllerTest.php to provide full test coverage for the MCP API controller. The tests cover critical paths including tool execution with argument validation, versioning logic (handling sunset and deprecated versions), and security enforcement for both API key scopes and server-level restrictions. All tests use Pest syntax and mock the necessary services and controller methods where appropriate.

Fixes #8


PR created automatically by Jules for task 8082099650712094462 started by @Snider

Added Feature tests for McpApiController covering:
- Tool execution flow (valid/invalid server/tool combinations)
- JSON schema validation for tool arguments
- Version resolution including sunset (410) and deprecation warnings
- Security boundaries (API key scopes and server restrictions)
- Discovery endpoints (listing servers and tools)
- Rate limiting headers

The tests use the Pest framework and follow project conventions.
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

QA Pipeline Results

Check Status Details
Tests tests, assertions
PHPStan errors
Psalm issues
Code Style files need formatting
Security vulnerabilities
Artifacts
  • test-results.xml - JUnit test results
  • phpstan.json - PHPStan analysis
  • psalm.json / psalm.sarif - Psalm analysis
  • pint.json - Code style report
  • audit.json - Security audit

Generated by core php qa pipeline

…te tests

- Added host-uk/core and host-uk/core-mcp repositories to composer.json to resolve dependency installation issues in CI.
- Updated McpApiControllerTest to consistently use the /api/v1 prefix as requested in code review.
- Ensured all tests include rate limiting header assertions.
- Added Feature tests for McpApiController covering tool execution, versioning, security scopes, and rate limiting.
- Updated all test routes to use the /api/v1/mcp prefix to match documentation and requirements.
- Included assertions for rate limiting headers (X-RateLimit-Limit, X-RateLimit-Remaining).
- Added the core-php repository to composer.json to help resolve the host-uk/core dependency in CI.

The tests use the Pest framework and mock the necessary services for isolated testing.
- Added require-dev section to composer.json with testing and analysis tools (Pest, PHPUnit, PHPStan, Psalm, Pint, Mockery).
- Updated the repositories section in composer.json to use the correct core-php repository URL.
- Fixed inconsistent API route prefixes in McpApiControllerTest, ensuring all use /api/v1/mcp.
- Verified rate limiting header assertions are present in all relevant tests.
@Snider Snider marked this pull request as ready for review February 5, 2026 03:25
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Warning

Rate limit exceeded

@Snider has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 25 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/mcp-api-tests-8082099650712094462

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

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.

Missing: Tests for MCP API Controller tool execution

1 participant