Skip to content

MCP tools/call hides actionable WP_Ability validation errors #225

Closed

Description

@rmorse

MCP tools/call hides actionable WP_Ability validation errors

Summary

When a WordPress ability rejects invalid input with a WP_Error, the actionable error message is available from the ability layer, and is still available when calling mcp-adapter/execute-ability directly.

However, when the same ability is executed through the MCP tools/call endpoint, the client receives only:

{
  "content": [
    {
      "type": "text",
      "text": "An error occurred while executing the tool."
    }
  ],
  "isError": true
}

This prevents LLM clients from seeing the validation error, correcting the payload, and retrying.

Example

Using the WooCommerce ability:

woocommerce/products-query

Its input schema has additionalProperties: false.

Calling it with an unsupported property:

{
  "unsupported": "value"
}

Direct ability execution returns a useful WP_Error:

{
  "type": "WP_Error",
  "code": "ability_invalid_input",
  "message": "Ability \"woocommerce/products-query\" has invalid input. Reason: unsupported is not a valid property of Object.",
  "data": null
}

Calling the MCP adapter ability directly also preserves the useful message:

{
  "success": false,
  "error": "Ability \"woocommerce/products-query\" has invalid input. Reason: unsupported is not a valid property of Object."
}

But calling the same operation through MCP tools/call returns only the generic error:

{
  "content": [
    {
      "type": "text",
      "text": "An error occurred while executing the tool."
    }
  ],
  "isError": true
}

Expected behavior

The MCP tool result should preserve at least the original ability error message:

Ability "woocommerce/products-query" has invalid input. Reason: unsupported is not a valid property of Object.

Ideally, if a WP_Error contains structured error data, that data should also be surfaced in structuredContent so LLM clients can correct invalid requests programmatically.

Why this matters

For LLM-facing tools, validation errors are actionable feedback, not opaque infrastructure failures. If the MCP layer replaces ability validation errors with a generic message, the model cannot repair the request.

This is especially important for tools with JSON schemas, where invalid properties, invalid enum values, and incorrect value types are common and recoverable.

Related

Possibly related to #175, which also reports the generic An error occurred while executing the tool. response in an MCP tool call failure path.

Activity

  1. galatanovidiu commented on Jul 3, 2026

    @galatanovidiu
    Contributor

    The generic message isn't from current mcp-adapter, it only exists in v0.3.0, which WooCommerce still bundles. Your test runs through that old copy.

    On trunk (v0.5.0+) you get the real error:

    Ability "woocommerce/products-query" has invalid input. Reason: unsupported is not a valid property of Object.

    Fix is on WooCommerce's side, bumping their mcp-adapter dependency (woocommerce/woocommerce#64052 does it).

    One caveat after the bump: input validation errors come through, but permission-callback errors stay generic on purpose. That's a security decision in the WP core Abilities API, not the adapter.

    Closing as fixed on trunk, reopen if it still shows up after the bump.

  2. galatanovidiu commented on Jul 3, 2026

    @galatanovidiu
    Contributor

    One more thing: You can install MCP-Adapter as a plugin on your website. This will make WooCommerce MCP use the new version. The new version is fully backward compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions