Automattic\WooCommerce\Internal\Abilities

AbilitiesTracking::is_json_rpc_tool_call │ private │ WC 1.0

Whether the outermost REST request is a JSON-RPC tools/call, as every MCP tool call over HTTP is, including from
2025-03-26 clients that send no MCP headers. Batches (2025-03-26) are checked message by message.

Метод класса: AbilitiesTracking{}

Хуков нет.

Возвращает

bool.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->is_json_rpc_tool_call(): bool;

Код AbilitiesTracking::is_json_rpc_tool_call() WC 11.3.0

private function is_json_rpc_tool_call(): bool {
	$request = $this->rest_requests[0] ?? null;
	$body    = $request ? $request->get_json_params() : null;
	if ( ! is_array( $body ) ) {
		return false;
	}
	foreach ( isset( $body['jsonrpc'] ) ? array( $body ) : $body as $message ) {
		if ( is_array( $message ) && '2.0' === ( $message['jsonrpc'] ?? null ) && 'tools/call' === ( $message['method'] ?? null ) ) {
			return true;
		}
	}
	return false;
}