Skip to content

Conversation

@galatanovidiu
Copy link
Contributor

Why

Following the fix applied to the tools handler, prompts and resources handlers also need to pass null instead of empty arrays to abilities without input schemas. This ensures consistency across all MCP component types and matches WP_Ability::validate_input() expectations.

What

  • Update PromptsHandler to pass null when abilities have no input schema and arguments are empty
  • Update ResourcesHandler to pass null for all resource reads (resources don't accept parameters)

Ensures abilities without input schemas receive null parameters instead of empty arrays or request params. This is consistent with WP_Ability::validate_input()           │
│   expectations and matches the fix applied to tools handler.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes parameter handling in Prompts and Resources handlers to align with the WP_Ability::validate_input() expectations, following a similar fix previously applied to the tools handler. The change ensures null is passed instead of empty arrays when abilities have no input schema.

Key Changes

  • PromptsHandler now checks if an ability has no input schema and empty arguments, passing null in such cases
  • ResourcesHandler unconditionally passes null for permission checks and execution since resources don't accept parameters

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
includes/Handlers/Resources/ResourcesHandler.php Updated to pass null instead of $request_params for resource reads
includes/Handlers/Prompts/PromptsHandler.php Added logic to pass null when ability has no input schema and arguments are empty

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

github-actions bot commented Oct 21, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: galatanovidiu <[email protected]>
Co-authored-by: JasonTheAdams <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

- Remove input_schema from test/resource ability in DummyAbility
- Update execute and permission callbacks to not expect parameters
- Update ResourcesHandler to call ability methods without parameters when no input is needed

Resources that don't require input should not have an input_schema defined, and their callbacks should not expect parameters to be passed.
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.94%. Comparing base (040625e) to head (1ced301).

Files with missing lines Patch % Lines
includes/Handlers/Prompts/PromptsHandler.php 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk      #77      +/-   ##
============================================
- Coverage     68.94%   68.94%   -0.01%     
- Complexity      821      823       +2     
============================================
  Files            46       46              
  Lines          3037     3040       +3     
============================================
+ Hits           2094     2096       +2     
- Misses          943      944       +1     
Flag Coverage Δ
unit 68.94% <83.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@galatanovidiu galatanovidiu self-assigned this Oct 21, 2025
@JasonTheAdams JasonTheAdams merged commit 9f3ce38 into trunk Oct 30, 2025
3 of 16 checks passed
@JasonTheAdams JasonTheAdams deleted the fix/parameter-handling-prompts-resources branch October 30, 2025 20:39
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.

3 participants