Automattic\WooCommerce\Internal\MCP
McpEndpointRemoval::get_endpoint_removed_response
Respond to a request to the removed WooCommerce MCP endpoint.
The response is a JSON-RPC error, which MCP clients surface to the user or agent, sent with HTTP status 410 Gone.
Метод класса: McpEndpointRemoval{}
Хуков нет.
Возвращает
WP_REST_Response.
Использование
$McpEndpointRemoval = new McpEndpointRemoval(); $McpEndpointRemoval->get_endpoint_removed_response( $request ): WP_REST_Response;
- $request(WP_REST_Request) (обязательный)
- The REST request.
Код McpEndpointRemoval::get_endpoint_removed_response() McpEndpointRemoval::get endpoint removed response WC 11.3.0
public function get_endpoint_removed_response( WP_REST_Request $request ): WP_REST_Response {
$params = $request->get_json_params();
$request_id = is_array( $params ) && isset( $params['id'] ) && ( is_string( $params['id'] ) || is_int( $params['id'] ) ) ? $params['id'] : null;
$adapter = rest_url( 'mcp/mcp-adapter-default-server' );
return new WP_REST_Response(
array(
'jsonrpc' => '2.0',
'id' => $request_id,
'error' => array(
'code' => -32000,
'message' => sprintf(
/* translators: 1: WooCommerce version, 2: MCP Adapter endpoint URL, 3: Documentation URL. */
__( 'The WooCommerce MCP endpoint (woocommerce/mcp) was removed in WooCommerce %1$s. To keep using WooCommerce with MCP, install and activate the MCP Adapter plugin (https://wordpress.org/plugins/mcp-adapter/) on this site, then connect your MCP client to %2$s using a WordPress application password. Documentation: %3$s', 'woocommerce' ),
self::REMOVED_IN,
$adapter,
self::DOCS_URL
),
'data' => array(
'replacement_endpoint' => $adapter,
'documentation_url' => self::DOCS_URL,
),
),
),
410
);
}