Skip to content

[MCP] Support object body param and Abilities API guidance#3455

Open
bgrgicak wants to merge 1 commit intotrunkfrom
add/mcp-abilities-tools
Open

[MCP] Support object body param and Abilities API guidance#3455
bgrgicak wants to merge 1 commit intotrunkfrom
add/mcp-abilities-tools

Conversation

@bgrgicak
Copy link
Copy Markdown
Collaborator

@bgrgicak bgrgicak commented Apr 1, 2026

Motivation for the change, related issues

MCP clients (like Claude) naturally produce object values for structured parameters. Currently, callers must JSON.stringify the body before passing it to playground_request, which is an unnecessary friction point — the tool should accept both forms.

Additionally, the Abilities API (/wp-json/wp-abilities/v1/abilities) is now available and should be surfaced in the tool's guidance so MCP clients know to use it.

Implementation details

  • New string_or_object param type – added to ToolParamType and handled in both the Zod schema builder (register-mcp-server-tools.ts) and the JSON Schema builder (paramsToJsonSchema in tool-definitions.ts via oneOf).
  • Auto-serialization in executortool-executors.ts now JSON.stringifys the body when it receives an object, passing strings through unchanged.
  • Updated tool description – the playground_request description now mentions the Abilities API as a first-class REST endpoint and trims redundant guidance text.

Testing Instructions

  • CI

@bgrgicak bgrgicak requested review from a team, adamziel, Copilot and zaerl April 1, 2026 21:05
@bgrgicak bgrgicak self-assigned this Apr 1, 2026
Copy link
Copy Markdown
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

Adds support for passing structured (object) request bodies to the playground_request MCP tool without requiring manual JSON.stringify, and updates tool guidance to mention the Abilities API endpoint.

Changes:

  • Introduces a new string_or_object parameter type and wires it through Zod + JSON Schema generation.
  • Auto-serializes object bodies in the playground_request executor.
  • Updates playground_request description guidance and adds an e2e test covering object body usage.

Reviewed changes

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

File Description
packages/playground/mcp/tests/e2e/mcp-tools.spec.ts Adds e2e coverage ensuring playground_request accepts object bodies.
packages/playground/mcp/src/tools/tool-executors.ts Serializes object bodies to JSON before issuing the HTTP request.
packages/playground/mcp/src/tools/tool-definitions.ts Adds string_or_object, updates tool guidance, and emits oneOf JSON Schema for the new type.
packages/playground/mcp/src/tools/register-mcp-server-tools.ts Adds Zod validation support for string_or_object.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bgrgicak bgrgicak force-pushed the add/mcp-abilities-tools branch from d205289 to cf54a01 Compare April 7, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants